From 9b41e90c766d75b4fdc414ddb3cfeb111e7db788 Mon Sep 17 00:00:00 2001 From: sub-versivo <105132121+sub-versivo@users.noreply.github.com> Date: Sat, 13 Jan 2024 14:14:14 +0000 Subject: [PATCH] feat: Add lang information on extension manager page (#173) * Add lang information on extension manager page * Put language after extension type on Android * upload --------- Co-authored-by: MiaoMint --- .../pages/extension/extension_repo_page.dart | 1 + .../widgets/extension/extension_card.dart | 96 ++++++++++--------- 2 files changed, 51 insertions(+), 46 deletions(-) diff --git a/lib/views/pages/extension/extension_repo_page.dart b/lib/views/pages/extension/extension_repo_page.dart index f5f15531..6e8101bf 100644 --- a/lib/views/pages/extension/extension_repo_page.dart +++ b/lib/views/pages/extension/extension_repo_page.dart @@ -62,6 +62,7 @@ class _ExtensionRepoPageState extends State { icon: e['icon'], version: e['version'], package: e['package'], + lang: e['lang'], nsfw: e['nsfw'] == 'true', type: ExtensionType.values.firstWhere( (element) => element.toString() == 'ExtensionType.${e['type']}', diff --git a/lib/views/widgets/extension/extension_card.dart b/lib/views/widgets/extension/extension_card.dart index f11a5b92..7ea5ce70 100644 --- a/lib/views/widgets/extension/extension_card.dart +++ b/lib/views/widgets/extension/extension_card.dart @@ -15,6 +15,7 @@ class ExtensionCard extends StatefulWidget { required this.version, required this.icon, required this.package, + required this.lang, required this.nsfw, required this.type, }); @@ -22,6 +23,7 @@ class ExtensionCard extends StatefulWidget { final String name; final String version; final String package; + final String lang; final ExtensionType type; final bool nsfw; @@ -80,35 +82,34 @@ class _ExtensionCardState extends State { ), ), title: Text(widget.name), - subtitle: Row( - children: [ - Padding( - padding: const EdgeInsets.only(right: 8), - child: Text( - widget.version, - style: const TextStyle(fontSize: 12), - ), - ), - Padding( - padding: const EdgeInsets.only(right: 8), - child: Text( - ExtensionUtils.typeToString(widget.type), - style: const TextStyle(fontSize: 12), - ), - ), - if (widget.nsfw) - const Padding( - padding: EdgeInsets.only(right: 8), - child: Text( - '18+', - style: TextStyle( - color: Colors.redAccent, - fontSize: 12, - ), + subtitle: DefaultTextStyle( + style: const TextStyle(fontSize: 12), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8), + child: Text(widget.version), ), - ), - ], - ), + Padding( + padding: const EdgeInsets.only(right: 8), + child: Text(ExtensionUtils.typeToString(widget.type)), + ), + Padding( + padding: const EdgeInsets.only(right: 8), + child: Text(widget.lang), + ), + if (widget.nsfw) + const Padding( + padding: EdgeInsets.only(right: 8), + child: Text( + '18+', + style: TextStyle( + color: Colors.redAccent, + ), + ), + ), + ], + )), trailing: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -172,27 +173,30 @@ class _ExtensionCardState extends State { ), const SizedBox(height: 8), Text(widget.name, style: const TextStyle(fontSize: 17)), - Row( - children: [ - Padding( - padding: const EdgeInsets.only(right: 8), - child: Text( - ExtensionUtils.typeToString(widget.type), - style: const TextStyle(fontSize: 12), + DefaultTextStyle( + style: const TextStyle(fontSize: 12), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8), + child: Text(ExtensionUtils.typeToString(widget.type)), ), - ), - if (widget.nsfw) - const Padding( - padding: EdgeInsets.only(right: 8), - child: Text( - '18+', - style: TextStyle( - color: Colors.redAccent, - fontSize: 12, + Padding( + padding: const EdgeInsets.only(right: 8), + child: Text(widget.lang), + ), + if (widget.nsfw) + const Padding( + padding: EdgeInsets.only(right: 8), + child: Text( + '18+', + style: TextStyle( + color: Colors.redAccent, + ), ), ), - ), - ], + ], + ), ), Row( children: [