Created
April 25, 2020 15:17
-
-
Save liudonghua123/4494ae5686c4806658ef49403cdc40b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: MyAppBar(title: Text('MyAppBar')), | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Text('Hello, World!', style: Theme.of(context).textTheme.headline4); | |
} | |
} | |
class MyAppBar extends AppBar implements PreferredSizeWidget { | |
MyAppBar({ | |
key, | |
leading, | |
automaticallyImplyLeading = true, | |
title, | |
actions, | |
flexibleSpace, | |
bottom, | |
elevation, | |
shape, | |
backgroundColor, | |
brightness, | |
iconTheme, | |
actionsIconTheme, | |
textTheme, | |
primary = true, | |
centerTitle, | |
excludeHeaderSemantics = false, | |
titleSpacing = NavigationToolbar.kMiddleSpacing, | |
toolbarOpacity = 1.0, | |
bottomOpacity = 1.0, | |
}) : super( | |
key: key, | |
leading: leading, | |
automaticallyImplyLeading: automaticallyImplyLeading, | |
title: title, | |
actions: actions, | |
flexibleSpace: flexibleSpace, | |
bottom: bottom, | |
elevation: elevation, | |
shape: shape, | |
backgroundColor: backgroundColor, | |
brightness: brightness, | |
iconTheme: iconTheme, | |
actionsIconTheme: actionsIconTheme, | |
textTheme: textTheme, | |
primary: primary, | |
centerTitle: centerTitle, | |
excludeHeaderSemantics: excludeHeaderSemantics, | |
titleSpacing: titleSpacing, | |
toolbarOpacity: toolbarOpacity, | |
bottomOpacity: bottomOpacity, | |
); | |
@override | |
Size get preferredSize => Size.fromHeight(24); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment