From f4fbbd3b1b25ef19c62f058772ca64411d14452e Mon Sep 17 00:00:00 2001 From: guoshuyu <359369982@qq.com> Date: Wed, 3 Jul 2024 10:08:41 +0800 Subject: [PATCH] fix #887 --- lib/common/localization/gsy_string_base.dart | 2 + lib/common/localization/gsy_string_en.dart | 2 + lib/common/localization/gsy_string_zh.dart | 2 + lib/common/utils/common_utils.dart | 2 + lib/page/home/widget/home_drawer.dart | 52 +++++++++++--------- lib/page/issue/issue_edit_dIalog.dart | 29 +++++++---- 6 files changed, 56 insertions(+), 33 deletions(-) diff --git a/lib/common/localization/gsy_string_base.dart b/lib/common/localization/gsy_string_base.dart index 0cc3e448..8cb116d9 100644 --- a/lib/common/localization/gsy_string_base.dart +++ b/lib/common/localization/gsy_string_base.dart @@ -266,4 +266,6 @@ abstract class GSYStringBase { String get search_sort; String get search_language; + + String get feed_back_tip; } diff --git a/lib/common/localization/gsy_string_en.dart b/lib/common/localization/gsy_string_en.dart index 29c54d37..380cb0ed 100644 --- a/lib/common/localization/gsy_string_en.dart +++ b/lib/common/localization/gsy_string_en.dart @@ -293,4 +293,6 @@ class GSYStringEn extends GSYStringBase { String search_sort = "sort"; @override String search_language = "language"; + @override + String feed_back_tip = "Your feedback will be submitted to GitHub through a public issue"; } diff --git a/lib/common/localization/gsy_string_zh.dart b/lib/common/localization/gsy_string_zh.dart index 777e8c51..6f3457cd 100644 --- a/lib/common/localization/gsy_string_zh.dart +++ b/lib/common/localization/gsy_string_zh.dart @@ -295,4 +295,6 @@ class GSYStringZh extends GSYStringBase { String search_sort = "排序"; @override String search_language = "语言"; + @override + String feed_back_tip = "你的反馈将通过 github issue 被提交"; } diff --git a/lib/common/utils/common_utils.dart b/lib/common/utils/common_utils.dart index f75e6743..f23a0019 100644 --- a/lib/common/utils/common_utils.dart +++ b/lib/common/utils/common_utils.dart @@ -433,6 +433,7 @@ class CommonUtils { TextEditingController? titleController, TextEditingController? valueController, bool needTitle = true, + String? hintText, }) { return NavigatorUtils.showGSYDialog( context: context, @@ -446,6 +447,7 @@ class CommonUtils { titleController: titleController, valueController: valueController, needTitle: needTitle, + hintText: hintText, ), ); }); diff --git a/lib/page/home/widget/home_drawer.dart b/lib/page/home/widget/home_drawer.dart index 34c03385..a7306149 100644 --- a/lib/page/home/widget/home_drawer.dart +++ b/lib/page/home/widget/home_drawer.dart @@ -29,7 +29,8 @@ class HomeDrawer extends StatelessWidget { context: context, builder: (BuildContext context) => AboutDialog( applicationName: GSYLocalizations.i18n(context)!.app_name, - applicationVersion: "${GSYLocalizations.i18n(context)!.app_version}: ${versionName ?? ""}", + applicationVersion: + "${GSYLocalizations.i18n(context)!.app_version}: ${versionName ?? ""}", applicationIcon: const Image( image: AssetImage(GSYICons.DEFAULT_USER_ICON), width: 50.0, @@ -91,9 +92,8 @@ class HomeDrawer extends StatelessWidget { onTap: () {}, child: CircleAvatar( //圆形图标控件 - backgroundImage: NetworkImage( - user.avatar_url ?? - GSYICons.DEFAULT_REMOTE_PIC), + backgroundImage: NetworkImage(user.avatar_url ?? + GSYICons.DEFAULT_REMOTE_PIC), ), ), decoration: BoxDecoration( @@ -102,36 +102,42 @@ class HomeDrawer extends StatelessWidget { ), ), ListTile( - title: Text( + title: Text( + GSYLocalizations.i18n(context)!.home_reply, + style: GSYConstant.normalText, + ), + onTap: () { + String content = ""; + CommonUtils.showEditDialog( + context, GSYLocalizations.i18n(context)!.home_reply, - style: GSYConstant.normalText, - ), - onTap: () { - String content = ""; - CommonUtils.showEditDialog( - context, - GSYLocalizations.i18n(context)!.home_reply, - (title) {}, (res) { + (title) {}, + (res) { content = res; - }, () { + }, + () { if (content.isEmpty) { return; } CommonUtils.showLoadingDialog(context); IssueDao.createIssueDao( "CarGuo", "gsy_github_app_flutter", { - "title": - GSYLocalizations.i18n(context)!.home_reply, + "title": GSYLocalizations.i18n(context)! + .home_reply, "body": content }).then((result) { Navigator.pop(context); Navigator.pop(context); }); }, - titleController: TextEditingController(), - valueController: TextEditingController(), - needTitle: false); - }), + titleController: TextEditingController(), + valueController: TextEditingController(), + needTitle: false, + hintText: + GSYLocalizations.i18n(context)!.feed_back_tip, + ); + }, + ), ListTile( title: Text( GSYLocalizations.i18n(context)!.home_history, @@ -176,11 +182,9 @@ class HomeDrawer extends StatelessWidget { onTap: () { CommonUtils.showLanguageDialog(context); }), - ListTile( title: Text( - GSYLocalizations.i18n(context)! - .home_change_grey, + GSYLocalizations.i18n(context)!.home_change_grey, style: GSYConstant.normalText, ), onTap: () { @@ -201,7 +205,7 @@ class HomeDrawer extends StatelessWidget { .home_about, style: GSYConstant.normalText, ), - onLongPress: (){ + onLongPress: () { NavigatorUtils.goDebugDataPage(context); }, onTap: () { diff --git a/lib/page/issue/issue_edit_dIalog.dart b/lib/page/issue/issue_edit_dIalog.dart index 7822bafd..aa8be9fc 100644 --- a/lib/page/issue/issue_edit_dIalog.dart +++ b/lib/page/issue/issue_edit_dIalog.dart @@ -21,10 +21,19 @@ class IssueEditDialog extends StatefulWidget { final TextEditingController? valueController; final bool needTitle; - - const IssueEditDialog(this.dialogTitle, this.onTitleChanged, this.onContentChanged, - this.onPressed, - {super.key, this.titleController, this.valueController, this.needTitle = true}); + final String? hintText; + + const IssueEditDialog( + this.dialogTitle, + this.onTitleChanged, + this.onContentChanged, + this.onPressed, { + super.key, + this.titleController, + this.valueController, + this.needTitle = true, + this.hintText, + }); @override _IssueEditDialogState createState() => _IssueEditDialogState(); @@ -58,8 +67,8 @@ class _IssueEditDialogState extends State { itemBuilder: (context, index) { return RawMaterialButton( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - padding: - const EdgeInsets.only(left: 8.0, right: 8.0, top: 5.0, bottom: 5.0), + padding: const EdgeInsets.only( + left: 8.0, right: 8.0, top: 5.0, bottom: 5.0), constraints: const BoxConstraints(minWidth: 0.0, minHeight: 0.0), child: Icon(FAST_INPUT_LIST[index].iconData, size: 16.0), onPressed: () { @@ -144,8 +153,9 @@ class _IssueEditDialogState extends State { onChanged: widget.onContentChanged, controller: widget.valueController, decoration: InputDecoration( - hintText: GSYLocalizations.i18n(context)! - .issue_edit_issue_title_tip, + hintText: widget.hintText ?? + GSYLocalizations.i18n(context)! + .issue_edit_issue_title_tip, hintStyle: GSYConstant.middleSubText, isDense: true, border: InputBorder.none, @@ -193,7 +203,8 @@ class _IssueEditDialogState extends State { minWidth: 0.0, minHeight: 0.0), onPressed: widget.onPressed, child: Text( - GSYLocalizations.i18n(context)!.app_ok, + GSYLocalizations.i18n(context)! + .app_ok, style: GSYConstant.normalTextBold))), ], )