重写avatar

hmxc
小赖 4 years ago
parent 5d65480cd5
commit 0be5099251

@ -56,6 +56,11 @@ class UserProvider extends ChangeNotifier {
return USER_INFO.UserInfoModel.fromJson(model.data);
}
logout() {
_isLogin = false;
notifyListeners();
}
bool _isSigned = false;
///

@ -11,13 +11,7 @@ class AgreementPage extends StatelessWidget {
title: '服务协议',
body: SingleChildScrollView(
padding: EdgeInsets.all(16.w),
child: Column(
children: [
Text(
'《服务协议》',
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 35.w),
),
Text(
child: Text(
'''
使APP
使APP使
@ -221,8 +215,6 @@ class AgreementPage extends StatelessWidget {
fontSize: 30.w,
),
),
],
),
),
);
}

@ -23,6 +23,7 @@ import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manag
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart';
import 'package:aku_community_manager/ui/tool_pages/scan_page.dart';
import 'package:aku_community_manager/ui/tool_pages/warning/warning_page.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_avatar.dart';
import 'package:aku_ui/aku_ui.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:carousel_slider/carousel_slider.dart';
@ -187,14 +188,7 @@ class _HomePageState extends State<HomePage> {
onTap: () {
Scaffold.of(context).openDrawer();
},
child: userProvider.isLogin
? FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(userProvider
.profileModel.firstImg?.url ??
''),
)
: Icon(Icons.person),
child: AkuAvatar(),
);
},
),
@ -450,7 +444,7 @@ class _HomePageState extends State<HomePage> {
),
SizedBox(height: 16.w),
//
!userProvider.isSigned
!userProvider.isLogin
? SizedBox()
: Row(
children: [
@ -489,7 +483,7 @@ class _HomePageState extends State<HomePage> {
),
SizedBox(height: 16.w),
//
!userProvider.isSigned
!userProvider.isLogin
? SizedBox()
: Container(
height: 480.w,
@ -520,7 +514,7 @@ class _HomePageState extends State<HomePage> {
),
SizedBox(height: 24.w),
//
!userProvider.isSigned
!userProvider.isLogin
? SizedBox()
: Container(
width: double.infinity,

@ -5,6 +5,7 @@ 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_community_manager/ui/widgets/app_widgets/aku_avatar.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';
@ -73,21 +74,7 @@ class _PersonalDrawState extends State<PersonalDraw> {
children: [
SizedBox(width: 32.w),
//
Material(
borderRadius: BorderRadius.circular(36.w),
clipBehavior: Clip.antiAlias,
color: Colors.grey,
child: userProvider.isLogin
? FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(
userProvider.profileModel.firstImg?.url ?? '',
),
height: 72.w,
width: 72.w,
)
: Icon(Icons.person),
),
AkuAvatar(),
SizedBox(width: 24.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -131,7 +118,7 @@ class _PersonalDrawState extends State<PersonalDraw> {
R.ASSETS_USER_IC_PERSON_PNG,
'个人信息',
onPressed: () {
userProvider.isSigned
userProvider.isLogin
? Get.to(UserInfoPage())
: Get.to(LoginPage());
},

@ -76,14 +76,14 @@ class _SettingsPageState extends State<SettingsPage> {
onTap: () => Get.to(AgreementPage()),
),
AkuBox.h(320),
userProvider.isSigned
userProvider.isLogin
? Padding(
padding: EdgeInsets.symmetric(horizontal: 64.w),
child: AkuMaterialButton(
radius: 8.w,
color: AppStyle.primaryColor,
onPressed: () {
userProvider.setisSigned(false);
userProvider.logout();
Get.offAll(HomePage());
},
child: Text(

@ -1,6 +1,7 @@
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_avatar.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:aku_community_manager/ui/widgets/inner/pick_image.dart';
@ -33,21 +34,7 @@ class _UserInfoPageState extends State<UserInfoPage> {
},
title: Text('头像'),
height: 168.w,
suffix: Material(
color: Colors.grey,
borderRadius: BorderRadius.circular(36.w),
clipBehavior: Clip.antiAlias,
child: userProvider.isLogin
? FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(
userProvider.profileModel.firstImg?.url ?? '',
),
height: 72.w,
width: 72.w,
)
: Icon(Icons.person),
),
suffix: AkuAvatar(),
),
AkuTile(
onTap: () {},

@ -0,0 +1,29 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class AkuAvatar extends StatelessWidget {
final double size;
AkuAvatar({Key key, this.size}) : super(key: key);
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return userProvider.isLogin
? Material(
color: Colors.grey,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(userProvider.profileModel.firstImg?.url ?? ''),
height: size ?? 72.w,
width: size ?? 72.w,
),
)
: CircleAvatar(
child: Icon(Icons.person),
);
}
}
Loading…
Cancel
Save