Created
September 20, 2021 15:52
-
-
Save PaulHalliday/51640a0b965a2a073aaf3eb3df33e863 to your computer and use it in GitHub Desktop.
Elevation
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'; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
const double customElevation = 30; | |
const double appBarGap = 60; | |
const gap = SizedBox(height: appBarGap); | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: ListView( | |
padding: const EdgeInsets.all(40), | |
children: [ | |
AppBar( | |
title: const Text("Custom: $customElevation", | |
style: TextStyle(color: Colors.black)), | |
elevation: customElevation, | |
backgroundColor: Colors.white, | |
), | |
gap, | |
const Text('Elevation', | |
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)), | |
for (final elevation in kElevationToShadow.entries) | |
Column(children: [ | |
gap, | |
AppBar( | |
title: Text("${elevation.key}", | |
style: const TextStyle(color: Colors.black)), | |
elevation: elevation.key.toDouble(), | |
backgroundColor: Colors.white, | |
), | |
]), | |
gap, | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment