import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; class YSBase extends StatefulWidget { final Widget yschild; final String ystitle; final Widget ysright; final Color yscolor; const YSBase({Key key, this.yschild,this.ystitle,this.ysright, this.yscolor}) : super(key: key); @override _YSBaseState createState() => _YSBaseState(); } class _YSBaseState extends State { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: widget.yscolor==null?Colors.white:widget.yscolor, appBar: CupertinoNavigationBar( transitionBetweenRoutes: false, backgroundColor: Colors.white, border: Border(bottom: BorderSide(color: Color(0xFFEEEEEE),width: 0.5)), leading: Container( height: 30, width: 20, margin: EdgeInsets.only(right: 35), child: CupertinoButton( padding: EdgeInsets.all(0), child: Icon(Icons.arrow_back_ios,size: 20,color: Color(0xFF000000),), onPressed: (){ FocusScope.of(context).unfocus(); Navigator.pop(context); }, ), ), middle: Text(widget.ystitle,style: TextStyle(color: Color(0xFF000000),fontSize: 16,decoration: TextDecoration.none,fontWeight: FontWeight.w600),textAlign: TextAlign.center,), trailing: widget.ysright, ), body: GestureDetector( onTap: (){ FocusScope.of(context).unfocus(); }, child: Container( height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44, child: SingleChildScrollView( child: widget.yschild, ), ), ), ); } }