import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class LayoutScaffold extends StatelessWidget { final AppBar appBar; final Widget? body; const LayoutScaffold({ Key? key, required this.appBar, this.body, }) : super(key: key); @override Widget build(BuildContext context) { Text title = appBar.title as Text; return Scaffold( appBar: PreferredSize( preferredSize: const Size.fromHeight(60), child: AppBar( actions: appBar.actions, leading: appBar.leading, title: Text( title.data ?? '', style: const TextStyle( fontSize: 25, ), ), centerTitle: true, bottom: appBar.bottom, systemOverlayStyle: const SystemUiOverlayStyle( statusBarColor: Colors.transparent, //设置为透明 statusBarIconBrightness: Brightness.dark, ), ), ), body: body, ); } }