import 'package:flutter/material.dart'; import '../tool/YSTools.dart'; class YSBase extends StatefulWidget { final Color ysColor; final bool isTab; final String ysTitle; final Widget? ysRightWidget; final Widget? ysChild; const YSBase({Key? key, this.ysColor = const Color(0xFF23262B), this.isTab = false, this.ysTitle = '', this.ysRightWidget, this.ysChild}) : super(key: key); @override YSBaseState createState() => YSBaseState(); } class YSBaseState extends State { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: widget.ysColor, body: GestureDetector( onTap: (){ FocusScope.of(context).unfocus(); }, child: SizedBox( width: ysWidth(context), height: ysHeight(context), child: SingleChildScrollView( child: Column( children: [ Container( height: ysTOP(context)+44, padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: ysTOP(context)), decoration: BoxDecoration( color: widget.ysColor, ), child: LayoutBuilder( builder: (context,conSize){ return Row( children: [ Container( width: hsp(50), alignment: Alignment.centerLeft, child: widget.isTab==true?SizedBox(width: hsp(30),):GestureDetector( onTap: (){ Navigator.pop(context); }, child: Container( height: hsp(30), width: hsp(30), alignment: Alignment.center, decoration: BoxDecoration( color: const Color(0xFF23262B), borderRadius: const BorderRadius.all(Radius.circular(50)), border: Border.all(color: const Color(0xFF23262B),width: hsp(1)), boxShadow: const [ BoxShadow(color: Color(0xFF3E434E),blurRadius: 5) ] ), child: Image.asset('images/tzh_back.png',height: hsp(20),width: hsp(20),), ) ), ), Container( width: conSize.maxWidth-hsp(100), padding: EdgeInsets.only(left: hsp(20),right: hsp(20)), alignment: Alignment.center, child: Text(widget.ysTitle,style: TextStyle(fontSize: zsp(17),color: Colors.white),), ), Container( width: hsp(50), alignment: Alignment.centerRight, child: widget.ysRightWidget??Container(), ) ], ); }, ), ), SizedBox( height: ysHeight(context)-ysTOP(context)-(widget.isTab?158:44), width: ysWidth(context), child: widget.ysChild, ) ], ), ), ), ), ); } }