Last active
May 10, 2020 03:13
-
-
Save code-brewer/156b790f895dd79ca3d436e643534c68 to your computer and use it in GitHub Desktop.
fullscreen demo
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( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
// Copy code from https://mrflutter.com/fullscreen-page-with-transparent-appbar-in-flutter/ | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Stack( | |
children: <Widget>[ | |
Container( | |
decoration: BoxDecoration( | |
image: DecorationImage( | |
image: NetworkImage( | |
'https://images.unsplash.com/photo-1517030330234-94c4fb948ebc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1275&q=80'), | |
fit: BoxFit.cover, | |
), | |
), | |
child: Center( | |
child: Text( | |
'mrflutter.com', | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 30, | |
), | |
), | |
), | |
), | |
Positioned( | |
child: AppBar( | |
title: Text("Transparent AppBar"), | |
backgroundColor: Colors.transparent, | |
elevation: 0, | |
actions: <Widget>[ | |
IconButton( | |
icon: Icon(Icons.share), | |
onPressed: () {}, | |
tooltip: 'Share', | |
), | |
], | |
), | |
) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment