YSBase.dart 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. class YSBase extends StatefulWidget {
  4. final Widget yschild;
  5. final String ystitle;
  6. final Widget ysright;
  7. final Color yscolor;
  8. const YSBase({Key key, this.yschild,this.ystitle,this.ysright, this.yscolor}) : super(key: key);
  9. @override
  10. _YSBaseState createState() => _YSBaseState();
  11. }
  12. class _YSBaseState extends State<YSBase> {
  13. @override
  14. Widget build(BuildContext context) {
  15. return Scaffold(
  16. backgroundColor: widget.yscolor==null?Colors.white:widget.yscolor,
  17. appBar: CupertinoNavigationBar(
  18. transitionBetweenRoutes: false,
  19. backgroundColor: Colors.white,
  20. border: Border(bottom: BorderSide(color: Color(0xFFEEEEEE),width: 0.5)),
  21. leading: Container(
  22. height: 30,
  23. width: 20,
  24. margin: EdgeInsets.only(right: 35),
  25. child: CupertinoButton(
  26. padding: EdgeInsets.all(0),
  27. child: Icon(Icons.arrow_back_ios,size: 20,color: Color(0xFF000000),),
  28. onPressed: (){
  29. FocusScope.of(context).unfocus();
  30. Navigator.pop(context);
  31. },
  32. ),
  33. ),
  34. middle: Text(widget.ystitle,style: TextStyle(color: Color(0xFF000000),fontSize: 16,decoration: TextDecoration.none,fontWeight: FontWeight.w600),textAlign: TextAlign.center,),
  35. trailing: widget.ysright,
  36. ),
  37. body: GestureDetector(
  38. onTap: (){
  39. FocusScope.of(context).unfocus();
  40. },
  41. child: Container(
  42. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44,
  43. child: SingleChildScrollView(
  44. child: widget.yschild,
  45. ),
  46. ),
  47. ),
  48. );
  49. }
  50. }