diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 61776ad..63c6508 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -92,4 +92,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c -COCOAPODS: 1.9.3 +COCOAPODS: 1.10.0 diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index cff09fb..cc3d9a7 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -26,6 +26,7 @@ class MessageLookup extends MessageLookupByLibrary { "Explore" : MessageLookupByLibrary.simpleMessage("Explore"), "Guide" : MessageLookupByLibrary.simpleMessage("Guide"), "Home" : MessageLookupByLibrary.simpleMessage("Home"), + "HomeNews" : MessageLookupByLibrary.simpleMessage("News"), "LanguageSettings" : MessageLookupByLibrary.simpleMessage("Language Settings"), "More" : MessageLookupByLibrary.simpleMessage("More"), "News" : MessageLookupByLibrary.simpleMessage("News"), diff --git a/lib/generated/intl/messages_ja.dart b/lib/generated/intl/messages_ja.dart index 2487ec2..1805698 100644 --- a/lib/generated/intl/messages_ja.dart +++ b/lib/generated/intl/messages_ja.dart @@ -26,6 +26,7 @@ class MessageLookup extends MessageLookupByLibrary { "Explore" : MessageLookupByLibrary.simpleMessage("見る"), "Guide" : MessageLookupByLibrary.simpleMessage("ガイド"), "Home" : MessageLookupByLibrary.simpleMessage("ホーム"), + "HomeNews" : MessageLookupByLibrary.simpleMessage("ニュース"), "LanguageSettings" : MessageLookupByLibrary.simpleMessage("言語設定"), "More" : MessageLookupByLibrary.simpleMessage("もっと"), "News" : MessageLookupByLibrary.simpleMessage("ニュース"), diff --git a/lib/generated/intl/messages_zh.dart b/lib/generated/intl/messages_zh.dart index 2716502..6cc1239 100644 --- a/lib/generated/intl/messages_zh.dart +++ b/lib/generated/intl/messages_zh.dart @@ -26,6 +26,7 @@ class MessageLookup extends MessageLookupByLibrary { "Explore" : MessageLookupByLibrary.simpleMessage("探索"), "Guide" : MessageLookupByLibrary.simpleMessage("导 乘"), "Home" : MessageLookupByLibrary.simpleMessage("首页"), + "HomeNews" : MessageLookupByLibrary.simpleMessage("资\n讯"), "LanguageSettings" : MessageLookupByLibrary.simpleMessage("语言设置"), "More" : MessageLookupByLibrary.simpleMessage("更多"), "News" : MessageLookupByLibrary.simpleMessage("资 讯"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 7f2e20c..406cca2 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -115,6 +115,16 @@ class S { ); } + /// `News` + String get HomeNews { + return Intl.message( + 'News', + name: 'HomeNews', + desc: '', + args: [], + ); + } + /// `No News` String get NoNews { return Intl.message( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 06a0d2f..36ad272 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -7,6 +7,7 @@ "RouteQuery": "Route Query", "Guide": "Guide", "News": "News", + "HomeNews": "News", "NoNews": "No News", "NoPictures": "No Pictures", "SearchLine": "Search Line", diff --git a/lib/l10n/intl_ja.arb b/lib/l10n/intl_ja.arb index c30dae7..1df0e02 100644 --- a/lib/l10n/intl_ja.arb +++ b/lib/l10n/intl_ja.arb @@ -7,6 +7,7 @@ "RouteQuery": "ルートクエリ", "Guide": "ガイド", "News": "ニュース", + "HomeNews": "ニュース", "NoNews": "情報はまだありません", "NoPictures": "写真はしばらくありません", "SearchLine": "経路を探索する", diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb index 81aab86..9910f1c 100644 --- a/lib/l10n/intl_zh.arb +++ b/lib/l10n/intl_zh.arb @@ -7,6 +7,7 @@ "RouteQuery": "线路查询", "Guide": "导 乘", "News": "资 讯", + "HomeNews": "资\n讯", "NoNews": "暂无资讯信息", "NoPictures": "暂无图片展示", "SearchLine": "搜索线路", diff --git a/lib/view/home/home_page.dart b/lib/view/home/home_page.dart index 1054650..eae63a0 100644 --- a/lib/view/home/home_page.dart +++ b/lib/view/home/home_page.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:weifangbus/entity/all_route_data_entity.dart'; import 'package:weifangbus/entity/headline_entity.dart'; @@ -260,6 +261,8 @@ class _HomePageState extends State /// 资讯信息 Widget infoShowWidget() { + var currentLocale = Intl.getCurrentLocale(); + print('current locale: $currentLocale'); return Container( child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -278,15 +281,25 @@ class _HomePageState extends State color: Colors.deepOrangeAccent, ), child: Padding( - child: AutoSizeText( - S.of(context).News, - style: TextStyle( - color: Colors.white, - ), - ), - padding: EdgeInsets.symmetric( - vertical: 3.h, - horizontal: 12.w, + child: currentLocale == 'zh' + ? AutoSizeText( + S.of(context).HomeNews, + style: TextStyle( + color: Colors.white, + ), + ) + : RotatedBox( + child: AutoSizeText( + S.of(context).HomeNews, + style: TextStyle( + color: Colors.white, + ), + maxLines: 1, + ), + quarterTurns: 3, + ), + padding: EdgeInsets.all( + 12.w, ), ), ), diff --git a/lib/view/home/searchbar/search_bar.dart b/lib/view/home/searchbar/search_bar.dart index d59a113..8181668 100644 --- a/lib/view/home/searchbar/search_bar.dart +++ b/lib/view/home/searchbar/search_bar.dart @@ -20,32 +20,23 @@ class _SearchBarState extends State { child: Container( decoration: BoxDecoration( color: Theme.of(context).backgroundColor, - borderRadius: BorderRadius.circular(4.0), + borderRadius: BorderRadius.circular(4), ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.only( - right: 25.w, - left: 25.w, - ), - child: Icon( - Icons.search, - size: 60.w, - color: Theme.of(context).accentColor, - ), - ), - Expanded( - child: MaterialSearchInput( - placeholder: S.of(context).SearchLine, - results: widget.allRouteList, - filter: (dynamic value, String criteria) { - return value.toLowerCase().trim().contains( - RegExp(r'' + criteria.toLowerCase().trim() + '')); - }, - ), - ), - ], + child: Padding( + padding: EdgeInsets.only( + left: 25.w, + right: 25.w, + ), + child: MaterialSearchInput( + placeholder: S.of(context).SearchLine, + results: widget.allRouteList, + filter: (dynamic value, String criteria) { + return value + .toLowerCase() + .trim() + .contains(RegExp(r'' + criteria.toLowerCase().trim() + '')); + }, + ), ), ), ); diff --git a/lib/view/home/searchbar/search_input.dart b/lib/view/home/searchbar/search_input.dart index aa48d17..7718d6a 100644 --- a/lib/view/home/searchbar/search_input.dart +++ b/lib/view/home/searchbar/search_input.dart @@ -1,5 +1,6 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; +import 'package:weifangbus/generated/l10n.dart'; typedef bool MaterialSearchFilter(T v, String c); typedef int MaterialSearchSort(T a, T b, String c); @@ -78,8 +79,6 @@ class MaterialSearchInput extends StatefulWidget { } class _MaterialSearchInputState extends State> { - GlobalKey> _formFieldKey = GlobalKey>(); - /// 调整到线路列表搜索页 _showMaterialSearch(BuildContext context) { Navigator.push( @@ -100,26 +99,19 @@ class _MaterialSearchInputState extends State> { ); } - bool _isEmpty(field) { - return field.value == null; - } - Widget build(BuildContext context) { return InkWell( onTap: () => _showMaterialSearch(context), - child: FormField( - key: _formFieldKey, - builder: (FormFieldState field) { - return InputDecorator( - isEmpty: _isEmpty(field), - decoration: InputDecoration( - labelText: widget.placeholder, - border: InputBorder.none, - errorText: field.errorText, - ), - child: _isEmpty(field) ? null : Text(field.value.toString()), - ); - }, + child: TextFormField( + decoration: InputDecoration( + hintText: S.of(context).SearchLine, + icon: Icon( + Icons.search, + color: Theme.of(context).accentColor, + ), + border: InputBorder.none, + enabled: false, + ), ), ); } @@ -233,6 +225,7 @@ class _MaterialSearchState extends State { return Scaffold( appBar: AppBar( title: TextField( + cursorColor: Colors.cyan, controller: _controller, autofocus: true, decoration: InputDecoration.collapsed(hintText: widget.placeholder), diff --git a/lib/view/more/about_software.dart b/lib/view/more/about_software.dart index 7c98ba4..0992089 100644 --- a/lib/view/more/about_software.dart +++ b/lib/view/more/about_software.dart @@ -1,5 +1,6 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:package_info/package_info.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -34,7 +35,7 @@ class _AboutDialog extends StatelessWidget { return AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), content: Container( - constraints: const BoxConstraints(maxWidth: 400), + constraints: BoxConstraints(maxWidth: 1.sw), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, diff --git a/lib/view/more/more_page.dart b/lib/view/more/more_page.dart index 5ea5df9..b65de87 100644 --- a/lib/view/more/more_page.dart +++ b/lib/view/more/more_page.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:weifangbus/util/font_util.dart'; import 'package:weifangbus/view/more/about_company.dart'; @@ -135,10 +136,13 @@ class _MorePageState extends State showDialog( context: context, builder: (_) => AlertDialog( - content: AutoSizeText( - "抱歉,检测到您还未安装QQ客户端!", - maxLines: 2, - overflow: TextOverflow.ellipsis, + content: Container( + width: 1.sw, + child: AutoSizeText( + "抱歉,检测到您还未安装QQ客户端!", + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), ), actions: [ FlatButton(