From a2f8e554b6e58b44cdb0e0ef0fe30648933a1aca Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 5 Nov 2020 22:03:07 +0800 Subject: [PATCH] update login --- lib/ui/agreements/agreement_page.dart | 13 ++++ lib/ui/agreements/privacy_page.dart | 13 ++++ lib/ui/home/personal_draw.dart | 98 ++++++++++++++------------- lib/ui/login/login_page.dart | 8 +++ lib/ui/settings/settings_page.dart | 9 ++- 5 files changed, 93 insertions(+), 48 deletions(-) create mode 100644 lib/ui/agreements/agreement_page.dart create mode 100644 lib/ui/agreements/privacy_page.dart diff --git a/lib/ui/agreements/agreement_page.dart b/lib/ui/agreements/agreement_page.dart new file mode 100644 index 0000000..d6a3817 --- /dev/null +++ b/lib/ui/agreements/agreement_page.dart @@ -0,0 +1,13 @@ +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; + +class AgreementPage extends StatelessWidget { + const AgreementPage({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '服务协议', + ); + } +} diff --git a/lib/ui/agreements/privacy_page.dart b/lib/ui/agreements/privacy_page.dart new file mode 100644 index 0000000..e25871d --- /dev/null +++ b/lib/ui/agreements/privacy_page.dart @@ -0,0 +1,13 @@ +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; + +class PrivacyPage extends StatelessWidget { + const PrivacyPage({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '隐私协议', + ); + } +} diff --git a/lib/ui/home/personal_draw.dart b/lib/ui/home/personal_draw.dart index 7d38a43..99129dd 100644 --- a/lib/ui/home/personal_draw.dart +++ b/lib/ui/home/personal_draw.dart @@ -56,56 +56,62 @@ class _PersonalDrawState extends State { child: ListView( children: [ SizedBox( - height: 80.w - 40.w + ScreenUtil().statusBarHeight, + height: ScreenUtil().statusBarHeight, ), //leading - Container( - margin: EdgeInsets.only(bottom: 80.w), - width: double.infinity, - child: Row( - children: [ - SizedBox(width: 32.w), - //头像按钮 - AkuRoundButton( - height: 72.w, - onPressed: () {}, - child: CircleAvatar( - radius: 36.w, - backgroundImage: userProvider.userInfoModel.avatar == null - ? null - : FileImage(userProvider.userInfoModel.avatar), - backgroundColor: Colors.white, - child: userProvider.isSigned - ? userProvider.userInfoModel.avatar == null - ? Icon(Icons.person_outline) - : null - : Icon(Icons.person), - ), - ), - SizedBox(width: 24.w), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - //登录按钮 - InkWell( - onTap: () {}, + InkWell( + onTap: () { + if (!userProvider.isSigned) { + Get.to(LoginPage()); + } + }, + child: Container( + margin: EdgeInsets.only(bottom: 80.w, top: 40.w), + width: double.infinity, + child: Row( + children: [ + SizedBox(width: 32.w), + //头像按钮 + AkuRoundButton( + height: 72.w, + onPressed: () {}, + child: CircleAvatar( + radius: 36.w, + backgroundImage: + userProvider.userInfoModel.avatar == null + ? null + : FileImage(userProvider.userInfoModel.avatar), + backgroundColor: Colors.white, child: userProvider.isSigned + ? userProvider.userInfoModel.avatar == null + ? Icon(Icons.person_outline) + : null + : Icon(Icons.person), + ), + ), + SizedBox(width: 24.w), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //登录按钮 + userProvider.isSigned ? Text( userProvider.userInfoModel.nickName, style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold), + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), ) - : Text('登录', + : Text( + '登录', style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold)), - ), - InkWell( - onTap: () {}, - child: Row( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + Row( children: [ Icon(Icons.location_on_outlined, size: 33.w), Text( @@ -116,10 +122,10 @@ class _PersonalDrawState extends State { ), ], ), - ), - ], - ), - ], + ], + ), + ], + ), ), ), _myListTile( diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart index 4afa613..47e1dff 100644 --- a/lib/ui/login/login_page.dart +++ b/lib/ui/login/login_page.dart @@ -2,6 +2,8 @@ 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/agreements/agreement_page.dart'; +import 'package:aku_community_manager/ui/agreements/privacy_page.dart'; import 'package:aku_community_manager/ui/login/login_sms_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; @@ -148,6 +150,9 @@ class _LoginPageState extends State { ), ExtendedWidgetSpan( child: GestureDetector( + onTap: () { + Get.to(AgreementPage()); + }, child: Text( '《服务协议》', style: TextStyle( @@ -162,6 +167,9 @@ class _LoginPageState extends State { ), ExtendedWidgetSpan( child: GestureDetector( + onTap: () { + Get.to(PrivacyPage()); + }, child: Text( '《隐私政策》', style: TextStyle( diff --git a/lib/ui/settings/settings_page.dart b/lib/ui/settings/settings_page.dart index e264d03..c63a63b 100644 --- a/lib/ui/settings/settings_page.dart +++ b/lib/ui/settings/settings_page.dart @@ -21,6 +21,7 @@ class SettingsPage extends StatefulWidget { } class _SettingsPageState extends State { + bool _info = false; @override Widget build(BuildContext context) { final userProvider = Provider.of(context); @@ -35,8 +36,12 @@ class _SettingsPageState extends State { title: Text('是否接受信息通知'), arrow: false, suffix: CupertinoSwitch( - value: false, - onChanged: (value) {}, + value: _info, + onChanged: (value) { + setState(() { + _info = value; + }); + }, ), ), Divider(height: 1.w),