提交 0a5b3ac8 authored 作者: yueweilu's avatar yueweilu

我的界面

上级 b7fc58b3
......@@ -21,7 +21,7 @@ class _MinePageState extends State<MinePage> {
padding: EdgeInsets.zero,
backgroundColor: Colors.transparent,
icon: const Icon(Ionicons.timer),
onPressed: () => context.pushNamed(Routes.msgs),
onPressed: () => context.pushNamed(Routes.coin),
),
CustomButton.icon(
padding: EdgeInsets.zero,
......@@ -42,13 +42,15 @@ class _MinePageState extends State<MinePage> {
margin: EdgeInsets.symmetric(horizontal: AppTheme.margin),
child: Column(
children: [
BuildUser(),
BuildUser(onTap: (){
context.pushNamed(Routes.userInfo);
},),
Gaps.vGaps10,
BuildRead(items: ['1','2','3','4'],),
Gaps.vGaps10,
BuildBanner(items: ['111','222','333'],),
Gaps.vGaps10,
BuildAccount(items: ['1','11','111','1111'],),
BuildAccount(items: ['1','11','紫荆币','1111'],),
Gaps.vGaps10,
Container(
decoration: BoxDecoration(
......@@ -65,7 +67,6 @@ class _MinePageState extends State<MinePage> {
],
),
),
BuildAccount(items: ['1','11','111','1111'],),
],
),
),
......
library user_coin;
import 'package:flutter/material.dart';
import 'package:flutter_book/theme.dart';
import 'package:flutter_book/utils/index.dart';
import 'package:flutter_book/widgets/index.dart';
part 'view.dart';
part 'widgets/cell.dart';
\ No newline at end of file
part of user_coin;
class UserCoinPage extends StatefulWidget {
const UserCoinPage({Key? key}) : super(key: key);
@override
State<UserCoinPage> createState() => _UserCoinPageState();
}
class _UserCoinPageState extends State<UserCoinPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
title: const Text('紫荆币'),
actions: [
GestureDetector(
onTap: (){
showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return Container(
height: 200,
color: Colors.white,
child: Center(
child: Text(
'This is the bottom sheet content',
style: TextStyle(fontSize: 18),
),
),
);
},
).then((value) {
print('================================================================');
});
},
child: Text('充值',style: TextStyle(color: AppTheme.primary),)
)
],
),
body: Container(
margin: EdgeInsets.symmetric(horizontal: AppTheme.margin,vertical: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white
),
child: ListView.builder(
itemBuilder: (BuildContext context, int index){
return const BuildCell();
},
itemCount: 10,
),
),
);
}
}
part of user_coin;
class BuildCell extends StatelessWidget {
const BuildCell({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
// color: Colors.green,
padding: EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Row(
children: [
Container(
width: 27,
height: 27,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(13.5),
color: Colors.cyan,
),
),
Gaps.hGaps10,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Gaps.vGaps15,
Text('账户充值',style: TextStyle(color: Colours.c3,fontSize: 14,height: 1.6,fontWeight: Fonts.medium),),
Text('2023-12-12 18:00:00',style:TextStyle(color: Colours.c9,fontSize: 10,height: 1.6,)),
Gaps.vGaps15,
],
)
],
),
),
Text('+188',style: TextStyle(fontSize: 17,fontWeight: Fonts.medium,color: AppTheme.primary),)
],
),
),
Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,),
],
);
}
}
library user_info;
import 'package:flutter/material.dart';
import 'package:flutter_book/theme.dart';
import 'package:flutter_book/utils/index.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:go_router/go_router.dart';
import '../../routes/index.dart';
part 'view.dart';
\ No newline at end of file
part of user_info;
class UserInfoPage extends StatefulWidget {
const UserInfoPage({Key? key}) : super(key: key);
@override
State<UserInfoPage> createState() => _UserInfoPageState();
}
class _UserInfoPageState extends State<UserInfoPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('个人信息'),
centerTitle: true,
),
body: Container(
margin: const EdgeInsets.symmetric(horizontal: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
/// 头像
Container(
height: 52,
padding: const EdgeInsets.only(left: 18,right: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('头像',style: TextStyle(color: Colours.c3,fontSize: 14,height: 1.6),),
Row(
children: [
Container(
width: 33.w,
height: 33.w,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.cyan,
),
),
Gaps.hGaps10,
Container(
width: 5,
height: 8,
color: Colors.cyan,
)
],
)
],
),
),
Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,),
_buildItem('昵称', '随便起个名字', Routes.nike),
Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,),
_buildItem('性别', '男', 'linkTo'),
],
),
)
);
}
Widget _buildItem(String title, String value,String linkTo,{VoidCallback? onTap}) {
return GestureDetector(
onTap: (){
if (linkTo.isNotEmpty){
context.pushNamed(linkTo);
if (onTap !=null) onTap;
}
},
child: Container(
padding: const EdgeInsets.only(left: 18,right: 15),
height: 52,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(title,style: const TextStyle(fontSize: 14,color: Colours.c3,),),
Row(
children: [
Text(value,style: const TextStyle(fontSize:14,color: Colours.c9,),),
Gaps.hGaps10,
Container(
width: 5,
height: 8,
color: Colors.cyan,
)
],
)
],
),
),
);
}
}
library user_nick;
import 'package:flutter/material.dart';
import 'package:flutter_book/theme.dart';
import 'package:flutter_book/utils/index.dart';
import 'package:flutter_book/widgets/index.dart';
part 'view.dart';
\ No newline at end of file
part of user_nick;
class UserNickPage extends StatefulWidget {
const UserNickPage({Key? key}) : super(key: key);
@override
State<UserNickPage> createState() => _UserNickPageState();
}
class _UserNickPageState extends State<UserNickPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
title: const Text('设置昵称'),
actions: [
Container(
height: 20,
width: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border:Border.all(
color: AppTheme.primary,
width: 1
)
),
child: Center(child: const Text('保存',style: TextStyle(fontSize: 12,color: AppTheme.primary),)),
)
],
),
body: Container(
margin: const EdgeInsets.symmetric(horizontal: AppTheme.margin),
height: 52,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white
),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15),
child: Row(
children: [
Text('昵称'),
Gaps.hGaps15,
Expanded(
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
suffixIcon: Center(
child: IconButton(
onPressed: (){
},
icon: Icon(Icons.clear),
),
),
suffixIconConstraints: BoxConstraints.tightFor(height: 15,width: 15)
),
),
)
],
),
),
),
);
}
}
......@@ -8,7 +8,10 @@ import 'package:flutter_book/pages/book_pay/index.dart';
import 'package:flutter_book/pages/login/index.dart';
import 'package:flutter_book/pages/main/index.dart';
import 'package:flutter_book/pages/splash/index.dart';
import 'package:flutter_book/pages/user_coin/index.dart';
import 'package:flutter_book/pages/user_info/index.dart';
import 'package:flutter_book/pages/user_msg/index.dart';
import 'package:flutter_book/pages/user_nick/index.dart';
import 'package:flutter_book/pages/web/index.dart';
import 'package:go_router/go_router.dart';
......
......@@ -18,6 +18,25 @@ abstract class Routes {
static const msgs = 'msgs';
/// 我的
// 个人信息
static const userInfo = 'user_info';
// 修改昵称
static const nike = 'nike';
// 性别
static const gender = 'gender';
// 设置
static const set = 'set';
// 版本
static const version = 'version';
// 版本介绍
static const versionDes = 'version_des';
// 我的收藏
static const collect = 'collect';
// 紫金币
static const coin = 'coin';
static final GoRouter config = GoRouter(
// initialLocation: '/$splash',
initialLocation: '/',
......@@ -103,6 +122,33 @@ abstract class Routes {
key: state.pageKey,
child: const MsgPage()
)
),
GoRoute(
path: '/$userInfo',
name: userInfo,
pageBuilder: (context, state) =>CupertinoPage(
name: state.uri.toString(),
key: state.pageKey,
child: const UserInfoPage()
)
),
GoRoute(
path: '/$nike',
name: nike,
pageBuilder: (context, state) =>CupertinoPage(
name: state.uri.toString(),
key: state.pageKey,
child: const UserNickPage()
)
),
GoRoute(
path: '/$coin',
name: coin,
pageBuilder: (context, state) =>CupertinoPage(
name: state.uri.toString(),
key: state.pageKey,
child: const UserCoinPage()
)
)
]
);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论