my_page.dart 3.58 KB
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';

class MyPage extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return new MyPageState();
  }
}

class MyPageState extends State<MyPage>{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      width: double.infinity,
      height: double.infinity,
      color: MyColours.color_f5f5f5,
      child: Column(
        children: <Widget>[
          MyAppBar("我的",showBack: false,backgroundColor: MyColours.color_2bb5b7,fontColor: MyColours.color_fefefe,),
          Container(
            width: double.infinity,
            height: ScreenUtil().setHeight(396),
            decoration: BoxDecoration(
              color: MyColours.color_2bb5b7,
              boxShadow: [BoxShadow(color: MyColours.color_2e000000,offset: Offset(.0,2.0))],
              borderRadius: BorderRadius.only(bottomLeft: Radius.circular(ScreenUtil().setWidth(350)),bottomRight: Radius.circular(ScreenUtil().setWidth(350)))
            ),
            child: Consumer<UserModel>(builder: (BuildContext context,UserModel model,Widget child){
              return Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  VEmptyView(25),
                  Image.asset("assets/my_logo.png",width: ScreenUtil().setWidth(228),height: ScreenUtil().setWidth(228),),
                  VEmptyView(40),
                  Text(model.user.sellername,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(32)),),
                  VEmptyView(12),
                  Text(model.user.account+"  |  "+model.user.role_name,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(30)),)
                ],
              );
            },)
            ),
          Consumer<UserModel>(builder: (BuildContext context,UserModel model,Widget child){
            return GestureDetector(
              onTap: (){
                model.loginOut(context, {"seller_code":model.user.sellercode,"account":model.user.account});
              },
              child: Container(
                height: ScreenUtil().setHeight(106),
                margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20),vertical: ScreenUtil().setHeight(40)),
                decoration: BoxDecoration(
                    color: MyColours.color_ffffff,
                    borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8))),
                    boxShadow: [BoxShadow(color: MyColours.color_14000000,offset: Offset(.0, 1.0))]
                ),
                child: Center(
                  child: Row(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: <Widget>[
                      Image.asset("assets/icon_exist.png",width: ScreenUtil().setWidth(30),height: ScreenUtil().setWidth(30),),
                      HEmptyView(18),
                      Text("退出登录",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(34),))
                    ],
                  ),
                ),
              ),
            );
          },)
        ],
      ),
    );
  }
}