diff --git a/lib/style/app_style.dart b/lib/style/app_style.dart index 981b331..82a8f1a 100644 --- a/lib/style/app_style.dart +++ b/lib/style/app_style.dart @@ -1,30 +1,31 @@ import 'package:flutter/material.dart'; + import 'package:flutter_screenutil/flutter_screenutil.dart'; + class AppStyle { //颜色,渐变主颜色和次级颜色 - static const primaryColor =Color(0xFFFDCF12); - static const minorColor=Color(0xFFFFDF5D); + static const primaryColor = Color(0xFFFDCF12); + static const minorColor = Color(0xFFFFDF5D); + static const secondaryColor = Color(0xFF3F8FFE); //字体 ///主字体颜色 - static const primaryTextColor=Color(0xFF333333); + static const primaryTextColor = Color(0xFF333333); + ///次字体颜色 - static const minorTextColor=Color(0xFF999999); + static const minorTextColor = Color(0xFF999999); + + ///背景色 + static const backgroundColor = Color(0xFFF9F9F9); - //字体格式 - final barTitleStyle=TextStyle( + ///字体格式 + final barTitleStyle = TextStyle( color: primaryTextColor, fontSize: 36.sp, fontWeight: FontWeight.bold, ); -final primaryStyle=TextStyle( - color: primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold -); -final minorStyle=TextStyle( - color: minorTextColor, - fontSize: 24.sp, - fontWeight: FontWeight.normal -); -} \ No newline at end of file + final primaryStyle = TextStyle( + color: primaryTextColor, fontSize: 28.sp, fontWeight: FontWeight.bold); + final minorStyle = TextStyle( + color: minorTextColor, fontSize: 24.sp, fontWeight: FontWeight.normal); +} diff --git a/lib/tools/widget_tool.dart b/lib/tools/widget_tool.dart index 55daaca..7ed578a 100644 --- a/lib/tools/widget_tool.dart +++ b/lib/tools/widget_tool.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -//自定义分割线 -class AkuDiveder { - final bool isReverse;//颜色方向反转 - const AkuDiveder({Key key,this.isReverse=false}); + +///自定义分割线 +class AkuDiveder { + final bool isReverse; //颜色方向反转 + const AkuDiveder({Key key, this.isReverse = false}); Widget verticalDivider(double height) { return Container( width: 1.w, @@ -23,6 +24,7 @@ class AkuDiveder { ])), ); } + Widget horizontalDivider(double width) { return Container( width: width, @@ -43,3 +45,17 @@ class AkuDiveder { ); } } + +class AkuBox { + static h(double height) { + return SizedBox( + height: height.w, + ); + } + + static w(double width) { + return SizedBox( + width: width.w, + ); + } +} diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index b73ca35..12dbc01 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -184,7 +184,6 @@ class _HomePageState extends State { Icons.access_alarm, size: 48.w, ), - SizedBox(height: 2.w), Text( '扫一扫', style: TextStyle( @@ -208,7 +207,6 @@ class _HomePageState extends State { Icons.access_time, size: 48.w, ), - SizedBox(height: 2.w), Text( '消息', style: TextStyle( diff --git a/lib/ui/home/personal_draw.dart b/lib/ui/home/personal_draw.dart index 321be78..3bb7a89 100644 --- a/lib/ui/home/personal_draw.dart +++ b/lib/ui/home/personal_draw.dart @@ -1,6 +1,8 @@ import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/login/login_page.dart'; import 'package:aku_community_manager/ui/settings/settings_page.dart'; +import 'package:aku_community_manager/ui/settings/user_info_page.dart'; import 'package:aku_ui/common_widgets/aku_button.dart'; import 'package:aku_ui/common_widgets/aku_round_button.dart'; import 'package:flutter/material.dart'; @@ -54,7 +56,6 @@ class _PersonalDrawState extends State { Container( margin: EdgeInsets.only(bottom: 80.w), width: double.infinity, - height: 72.w, child: Row( children: [ SizedBox(width: 32.w), @@ -108,7 +109,15 @@ class _PersonalDrawState extends State { ], ), ), - _myListTile(Icons.contact_page, '个人信息'), + _myListTile( + Icons.contact_page, + '个人信息', + onPressed: () { + userProvider.isSigned + ? Get.to(UserInfoPage()) + : Get.to(LoginPage()); + }, + ), _myListTile(Icons.supervised_user_circle, '联系客服'), _myListTile(Icons.settings, '设置', onPressed: () { Get.to(SettingsPage()); diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart new file mode 100644 index 0000000..5d7fad1 --- /dev/null +++ b/lib/ui/login/login_page.dart @@ -0,0 +1,134 @@ +import 'dart:ui'; + +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:extended_text/extended_text.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; + +class LoginPage extends StatefulWidget { + LoginPage({Key key}) : super(key: key); + + @override + _LoginPageState createState() => _LoginPageState(); +} + +class _LoginPageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + backgroundColor: Colors.white, + leading: AkuBackButton.close(), + body: ListView( + children: [ + Padding( + padding: EdgeInsets.only( + top: 40.w, + bottom: 184.w, + left: 32.w, + ), + child: Text( + '欢迎登录小蜜蜂', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 48.sp, + ), + ), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Text( + '手机号码', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 24.sp, + ), + ), + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 32.w), + width: double.infinity, + child: TextField( + autofocus: true, + keyboardType: TextInputType.phone, + decoration: InputDecoration( + border: UnderlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFE8E8E8), + width: 1.w, + ), + ), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFE8E8E8), + width: 2.w, + ), + ), + ), + ), + ), + AkuBox.h(80), + Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: AkuMaterialButton( + color: AppStyle.minorColor, + onPressed: () {}, + radius: 8.w, + child: Text('获取验证码'), + ), + ), + ], + ), + bottom: Container( + height: 110.w, + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 40.w), + child: ExtendedText.rich( + TextSpan( + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.sp, + ), + children: [ + TextSpan( + text: '登录即代表您已同意我们的', + ), + ExtendedWidgetSpan( + child: GestureDetector( + child: Text( + '《服务协议》', + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 22.sp, + ), + ), + ), + ), + TextSpan( + text: '和', + ), + ExtendedWidgetSpan( + child: GestureDetector( + child: Text( + '《隐私政策》', + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 22.sp, + ), + ), + ), + ), + TextSpan( + text: '', + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/ui/settings/setting_feedback_page.dart b/lib/ui/settings/setting_feedback_page.dart new file mode 100644 index 0000000..4fb4478 --- /dev/null +++ b/lib/ui/settings/setting_feedback_page.dart @@ -0,0 +1,64 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; + +class SettingFeedBackPage extends StatefulWidget { + SettingFeedBackPage({Key key}) : super(key: key); + + @override + _SettingFeedBackPageState createState() => _SettingFeedBackPageState(); +} + +class _SettingFeedBackPageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '意见反馈', + backgroundColor: Colors.white, + body: ListView( + children: [ + Container( + height: 20.w, + color: AppStyle.backgroundColor, + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 24.w, + horizontal: 32.w, + ), + padding: EdgeInsets.all(24.w), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + minLines: 5, + maxLines: 99, + decoration: InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + hintText: '请输入你的意见和建议', + hintStyle: TextStyle( + color: Color(0xFF999999), + fontSize: 28.sp, + ), + ), + ), + ], + ), + decoration: BoxDecoration( + color: AppStyle.backgroundColor, + borderRadius: BorderRadius.circular(16.w), + ), + ), + ], + ), + bottom: AkuMaterialButton( + onPressed: () {}, + child: Text('提交'), + color: AppStyle.minorColor, + ), + ); + } +} diff --git a/lib/ui/settings/settings_page.dart b/lib/ui/settings/settings_page.dart index 65f861a..d2d5458 100644 --- a/lib/ui/settings/settings_page.dart +++ b/lib/ui/settings/settings_page.dart @@ -1,5 +1,11 @@ +import 'package:aku_community_manager/ui/settings/setting_feedback_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_tile.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:get/get.dart'; class SettingsPage extends StatefulWidget { SettingsPage({Key key}) : super(key: key); @@ -12,8 +18,39 @@ class _SettingsPageState extends State { @override Widget build(BuildContext context) { return AkuScaffold( - title: '设置', - body: Text('test'), + title: '设置', + body: ListView( + padding: EdgeInsets.symmetric( + vertical: 16.w, + ), + children: [ + AkuTile( + title: Text('是否接受信息通知'), + arrow: false, + suffix: CupertinoSwitch( + value: false, + onChanged: (value) {}, + ), + ), + Divider(height: 1.w), + AkuTile( + title: Text('关于我们'), + arrow: true, + ), + Divider(height: 1.w), + AkuTile( + title: Text('意见反馈'), + arrow: true, + onTap: () => Get.to(SettingFeedBackPage()), + ), + Divider(height: 1.w), + AkuTile( + title: Text('清理缓存'), + arrow: true, + onTap: () => BotToast.showText(text: '缓存清理完成'), + ), + ], + ), ); } } diff --git a/lib/ui/settings/user_info_page.dart b/lib/ui/settings/user_info_page.dart new file mode 100644 index 0000000..fcb9e2e --- /dev/null +++ b/lib/ui/settings/user_info_page.dart @@ -0,0 +1,40 @@ +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_tile.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:get/get.dart'; + +class UserInfoPage extends StatefulWidget { + UserInfoPage({Key key}) : super(key: key); + + @override + _UserInfoPageState createState() => _UserInfoPageState(); +} + +class _UserInfoPageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '个人信息', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 24.w), + children: [ + AkuTile( + onTap: () {}, + title: Text('头像'), + height: 168.w, + suffix: CircleAvatar(radius: 60.w), + ), + AkuTile( + onTap: () {}, + title: Text('昵称'), + ), + AkuTile( + onTap: () {}, + title: Text('手机'), + ), + ], + ), + ); + } +} diff --git a/lib/ui/widgets/common/aku_back_button.dart b/lib/ui/widgets/common/aku_back_button.dart index e3c49e9..71ddd6e 100644 --- a/lib/ui/widgets/common/aku_back_button.dart +++ b/lib/ui/widgets/common/aku_back_button.dart @@ -3,9 +3,17 @@ import 'package:aku_community_manager/tools/screen_tool.dart'; class AkuBackButton extends StatefulWidget { final Brightness brightness; + final IconData icon; AkuBackButton({ Key key, this.brightness = Brightness.light, + this.icon = Icons.arrow_back_ios, + }) : super(key: key); + + AkuBackButton.close({ + Key key, + this.brightness = Brightness.light, + this.icon = Icons.clear, }) : super(key: key); @override @@ -18,7 +26,7 @@ class _AkuBackButtonState extends State { return Navigator.canPop(context) ? IconButton( icon: Icon( - Icons.arrow_back_ios, + widget.icon, size: 32.w, color: widget.brightness == Brightness.light ? Color(0xFF333333) diff --git a/lib/ui/widgets/common/aku_scaffold.dart b/lib/ui/widgets/common/aku_scaffold.dart index c34817c..613d514 100644 --- a/lib/ui/widgets/common/aku_scaffold.dart +++ b/lib/ui/widgets/common/aku_scaffold.dart @@ -35,10 +35,14 @@ class AkuScaffold extends StatefulWidget { ///body final Widget body; + final Widget bottom; + ///背景色 /// ///默认`0xFFF9F9F9` final Color backgroundColor; + + final Color appBarColor; AkuScaffold({ Key key, this.appBar, @@ -48,6 +52,8 @@ class AkuScaffold extends StatefulWidget { this.brightness = Brightness.light, this.body, this.backgroundColor = const Color(0XFFF9F9F9), + this.bottom, + this.appBarColor = Colors.white, }) : super(key: key); @override @@ -60,7 +66,7 @@ class _AkuScaffoldState extends State { return Scaffold( backgroundColor: widget.backgroundColor, appBar: AppBar( - backgroundColor: Colors.white, + backgroundColor: widget.appBarColor, leading: widget.leading ?? AkuBackButton(), brightness: widget.brightness, elevation: 0, @@ -72,10 +78,11 @@ class _AkuScaffoldState extends State { color: Color(0xFF333333), fontSize: 36.sp, ), - child: Text(widget.title), + child: Text(widget.title ?? ''), ), ), body: widget.body, + bottomNavigationBar: widget.bottom, ); } } diff --git a/lib/ui/widgets/common/aku_tile.dart b/lib/ui/widgets/common/aku_tile.dart new file mode 100644 index 0000000..4570dc1 --- /dev/null +++ b/lib/ui/widgets/common/aku_tile.dart @@ -0,0 +1,70 @@ +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; + +class AkuTile extends StatefulWidget { + final Widget prefix; + final Widget suffix; + final Widget title; + final bool arrow; + final Color color; + final double height; + + final VoidCallback onTap; + AkuTile({ + Key key, + this.prefix, + this.suffix, + this.title, + this.arrow = true, + this.onTap, + this.color = Colors.white, + this.height, + }) : super(key: key); + + @override + _AkuTileState createState() => _AkuTileState(); +} + +class _AkuTileState extends State { + double get height => widget.height ?? 96.w; + @override + Widget build(BuildContext context) { + return SizedBox( + height: height, + child: Material( + color: widget.color, + child: InkWell( + onTap: widget.onTap, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Row( + children: [ + widget.prefix ?? SizedBox(), + DefaultTextStyle( + style: TextStyle( + color: Color(0xFF333333), + fontSize: 28.sp, + ), + child: widget.title, + ), + Spacer(), + widget.suffix ?? SizedBox(), + widget.suffix != null && widget.arrow + ? SizedBox(width: 24.w) + : SizedBox(), + widget.arrow + ? Icon( + Icons.arrow_forward_ios, + size: 24.w, + color: Color(0xFF999999), + ) + : SizedBox(), + ], + ), + ), + ), + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 9013723..3ece33e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -73,6 +73,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + extended_text: + dependency: "direct main" + description: + name: extended_text + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.0" + extended_text_library: + dependency: transitive + description: + name: extended_text_library + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.1" fake_async: dependency: transitive description: @@ -216,4 +230,4 @@ packages: version: "2.1.0-nullsafety.3" sdks: dart: ">=2.10.0 <2.11.0" - flutter: ">=1.17.0 <2.0.0" + flutter: ">=1.20.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 5db18a1..0248e80 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,6 +42,8 @@ dependencies: #toast bot_toast: ^3.0.4 + extended_text: ^4.0.0 + aku_ui: git: url: http://test.akuhotel.com:8099/aku_fe/aku_ui.git