Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(new MyApp());
- class MyApp extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return new MaterialApp(
- title: 'Transparent AppBar',
- debugShowCheckedModeBanner: false,
- theme: new ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: new MyHomePage(),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- @override
- _MyHomePageState createState() => new _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Stack(
- children: <Widget>[
- Container(
- //color: Colors.orange,
- decoration: BoxDecoration(
- image: DecorationImage(
- // Replace this image with an image you have... and don't forget to declare it in pubspec.yaml
- image: AssetImage("assets/evan-kirby-226482-unsplash.jpg"),
- fit: BoxFit.cover,
- ),
- ),
- child: Center(
- child: Text("Hello World!\nwith transparent AppBar...", style: TextStyle(fontSize: 18.0, color: Colors.white))
- ),
- ),
- AppBar(
- backgroundColor: Colors.transparent,
- elevation: 0.0,
- leading: IconButton(
- icon: Icon(
- Icons.arrow_back_ios,
- ),
- color: Colors.white,
- onPressed: () {},
- ),
- title: Text("Transparent AppBar"),
- actions: <Widget>[
- IconButton(
- icon: Icon(
- Icons.menu,
- ),
- color: Colors.white,
- onPressed: () {},
- ),
- ],
- )
- ]
- )
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement