Skip to content

Instantly share code, notes, and snippets.

@liudonghua123
Created April 25, 2020 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liudonghua123/4494ae5686c4806658ef49403cdc40b5 to your computer and use it in GitHub Desktop.
Save liudonghua123/4494ae5686c4806658ef49403cdc40b5 to your computer and use it in GitHub Desktop.
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