123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutterappfuyou/code/base/YSTools.dart';
- class YSBase extends StatefulWidget {
- final Widget yschild;
- final String ystitle;
- final Widget ysright;
- final Color ysColor;
- final Color ysBgColor;
- final bool isBack;
- const YSBase({Key key, this.yschild,this.ystitle,this.ysright, this.ysColor, this.ysBgColor, this.isBack = true}) : super(key: key);
- @override
- _YSBaseState createState() => _YSBaseState();
- }
- class _YSBaseState extends State<YSBase> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: widget.ysBgColor??Colors.white,
- body: Stack(
- children: [
- Container(
- height: MediaQuery.of(context).padding.top+70,
- width: MediaQuery.of(context).size.width,
- color: widget.ysColor??Color(0xFFDB5278),
- ),
- Container(
- margin: EdgeInsets.only(top: 20),
- padding: EdgeInsets.only(left: 15,right: 15),
- height: 30+MediaQuery.of(context).padding.top,
- width: MediaQuery.of(context).size.width,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- height: 30,
- width: 20,
- margin: EdgeInsets.only(right: 35),
- child: widget.isBack?CupertinoButton(
- padding: EdgeInsets.all(0),
- child: Icon(Icons.arrow_back_ios,size: 20,color: Colors.white,),
- onPressed: (){
- FocusScope.of(context).unfocus();
- Navigator.pop(context);
- },
- ):Container(),
- ),
- Container(
- width: ysWidth(context)-150,
- child: Text(widget.ystitle,style: TextStyle(color: Colors.white,fontSize: 16,decoration: TextDecoration.none,fontWeight: FontWeight.w600),
- textAlign: TextAlign.center,maxLines: 1,),
- ),
- Container(
- width: 55,
- height: 30,
- child: widget.ysright,
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: 50+MediaQuery.of(context).padding.top),
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-50,
- width: MediaQuery.of(context).size.width,
- decoration: BoxDecoration(
- color: widget.ysBgColor??Color(0xFFFAF8F5),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(20),topRight: Radius.circular(20))
- ),
- child: widget.yschild,
- )
- ],
- ),
- );
- }
- }
- class YSBase2 extends StatefulWidget {
- final String title;
- final Color color;
- final Widget child;
- const YSBase2({Key key, this.title = '', this.color, @required this.child}) : super(key: key);
- @override
- _YSBase2State createState() => _YSBase2State();
- }
- class _YSBase2State extends State<YSBase2> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: CupertinoNavigationBar(
- backgroundColor: Colors.white,
- leading: GestureDetector(
- child: Icon(Icons.arrow_back_ios,size: 20),
- onTap: (){
- Navigator.pop(context);
- },
- ),
- middle: Text(widget.title,style: TextStyle(fontSize: 16),),
- ),
- body: Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44,
- width: MediaQuery.of(context).size.width,
- color: widget.color??Colors.white,
- child: SingleChildScrollView(
- child: widget.child,
- ),
- ),
- );
- }
- }
- class CustomerValueNotification extends Notification {
- final Map value;
- CustomerValueNotification(this.value);
- }
|