| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'my_page/revise_password_page.dart';
- class MyPage extends StatefulWidget {
- final Widget child;
- MyPage({
- Key key,
- this.child
- }): super(key: key);
- _MyPageState createState() => _MyPageState();
- }
- class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin{
- bool check = false;
- @override
- bool get wantKeepAlive => true;
- @override
- Widget build(BuildContext context) {
- return Container(
- child: Scaffold(
- appBar: AppBar(
- elevation: 0,
- title: Text('我的',
- style: TextStyle(
- fontSize: ScreenUtil.getInstance().setSp(36)
- ), ),
- centerTitle: true,
- backgroundColor: Color.fromRGBO(64, 98, 254, 1),
- ),
- body: Container(
- color: Color.fromRGBO(246, 246, 254, 1),
- child: Column(
- children: < Widget > [
- _avatarWidget(),
- _funWrapWidget(check)
- ],
- ),
- ),
- )
- );
- }
- Widget _avatarWidget() {
- return Container(
- color: Color.fromRGBO(64, 98, 254, 1),
- padding: EdgeInsets.fromLTRB(0, ScreenUtil.getInstance().setHeight(59), 0, ScreenUtil.getInstance().setHeight(67), ),
- child: Column(
- children: < Widget > [
- Center(
- child: Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setWidth(24), ),
- child: ClipOval(
- child: Image.network('https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1551526964140&di=5c6270bf8b43e9ce83427b01da959481&imgtype=jpg&src=http%3A%2F%2Fimg0.imgtn.bdimg.com%2Fit%2Fu%3D3327849645%2C2696105688%26fm%3D214%26gp%3D0.jpg',
- fit: BoxFit.cover,
- width: ScreenUtil.getInstance().setWidth(120),
- height: ScreenUtil.getInstance().setWidth(120), ),
- )
- )
- ),
- Center(child: Text('Alisa Lin', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(255, 255, 255, 1)), ), )
- ],
- ),
- );
- }
- Widget _funWrapWidget(bool check) {
- return Container(
- padding: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(20)),
- child: Column(
- children: < Widget > [
- _switchSite(),
- _passWordWidget(),
- _linkPrint(check)
- ],
- ),
- );
- }
- Widget _switchSite() {
- return Container(
- height: ScreenUtil.getInstance().setHeight(90),
- color: Colors.white,
- padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setHeight(30), 0, 0, 0),
- child: Column(
- children: < Widget > [
- Expanded(
- child: Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: < Widget > [
- Expanded(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: < Widget > [
- Padding(
- padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(22)),
- child: Image.asset('lib/images/icon_zhandianss.png',
- width: ScreenUtil.getInstance().setWidth(30),
- height: ScreenUtil.getInstance().setHeight(34),
- )
- ),
- Text('站点切换', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
- ],
- ),
- ),
- Expanded(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: < Widget > [
- Text('大兴站点', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(153, 153, 153, 1)), ),
- Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1))
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- Expanded(
- flex: 0,
- child: _underLine(),
- )
- ],
- )
- );
- }
- Widget _underLine() {
- return Container(
- height: ScreenUtil.getInstance().setHeight(1),
- color: Color.fromRGBO(223, 223, 223, 1),
- );
- }
- Widget _passWordWidget() {
- return
- GestureDetector(
- child: Container(
- height: ScreenUtil.getInstance().setHeight(90),
- color: Colors.white,
- padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setHeight(30), 0, 0, 0),
- child: Column(
- children: < Widget > [
- Expanded(
- child: Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: < Widget > [
- Expanded(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: < Widget > [
- Padding(
- padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(22)),
- child: Image.asset('lib/images/icon_mimas.png',
- width: ScreenUtil.getInstance().setWidth(30),
- height: ScreenUtil.getInstance().setHeight(34),
- )
- ),
- Text('修改密码', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
- ],
- ),
- ),
- Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1))
- ],
- ),
- ),
- )
- ],
- )
- ),
- onTap: () {
- Navigator.push(context, MaterialPageRoute(builder: (context) {
- return RevisePasswordPage();
- }));
- },
- );
- }
- Widget _linkPrint(bool check) {
- return Container(
- height: ScreenUtil.getInstance().setHeight(90),
- color: Colors.white,
- padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setHeight(30), 0, 0, 0),
- margin: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(20)),
- child: Column(
- children: < Widget > [
- Expanded(
- child: Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: < Widget > [
- Expanded(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: < Widget > [
- Padding(
- padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(22)),
- child: Image.asset('lib/images/icon_dayinji.png',
- width: ScreenUtil.getInstance().setWidth(30),
- height: ScreenUtil.getInstance().setHeight(34),
- )
- ),
- Text('打印机连接', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
- ],
- ),
- ),
- Switch(
- value: this.check,
- activeColor: Colors.blue,
- onChanged: (bool val) {
- print("val:${val}");
- this.setState(() {
- this.check = val;
- });
- print('check:${this.check}');
- },
- )
- ],
- ),
- ),
- )
- ],
- )
- );
- }
- }
|