Skip to content

Commit

Permalink
Dark mode v1
Browse files Browse the repository at this point in the history
  • Loading branch information
JobinBiju committed Nov 3, 2020
1 parent 5a12065 commit 661f60e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 26 deletions.
1 change: 1 addition & 0 deletions assets/icons/menu_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 11 additions & 5 deletions lib/samples/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ class _HomeScreenState extends State<HomeScreen> {
double scaleFactor = 1;
bool isDrawerOpen = false;
double borderRadius = 0;
bool isDark = false;

@override
Widget build(BuildContext context) {
return AnimatedContainer(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(borderRadius),
color: Colors.white,
color: isDark ? Color(0xff373a40) : Colors.white,
boxShadow: [kDefaultShadow],
),
transform: Matrix4.translationValues(xOffset, yOffset, 0)
Expand All @@ -38,7 +39,10 @@ class _HomeScreenState extends State<HomeScreen> {
children: [
isDrawerOpen
? IconButton(
icon: Icon(Icons.arrow_back_ios),
icon: Icon(
Icons.arrow_back_ios,
color: isDark ? Colors.white : Colors.black,
),
onPressed: () {
setState(() {
xOffset = 0;
Expand All @@ -50,7 +54,9 @@ class _HomeScreenState extends State<HomeScreen> {
},
)
: IconButton(
icon: SvgPicture.asset('assets/icons/menu.svg'),
icon: isDark
? SvgPicture.asset('assets/icons/menu_dark.svg')
: SvgPicture.asset('assets/icons/menu.svg'),
onPressed: () {
setState(() {
xOffset = 230;
Expand All @@ -64,14 +70,14 @@ class _HomeScreenState extends State<HomeScreen> {
'Title101',
style: TextStyle(
fontSize: 20,
color: Colors.black,
color: isDark ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
),
),
IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
color: isDark ? Colors.white : Colors.black,
size: 30,
),
onPressed: null,
Expand Down
20 changes: 0 additions & 20 deletions lib/samples/top_app_bar_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,6 @@ class TopBar extends StatelessWidget {
return Scaffold(
key: _scaffoldKey,
backgroundColor: kBackgroundColor,
// appBar: AppBar(
// backgroundColor: Colors.transparent,
// elevation: 0,
// leading: IconButton(
// icon: SvgPicture.asset('assets/icons/menu.svg'),
// onPressed: () => _scaffoldKey.currentState.openDrawer(),
// ),
// actions: [
// Padding(
// padding: EdgeInsets.only(right: 8.0),
// child: IconButton(
// icon: Icon(
// Icons.search,
// color: Colors.black,
// ),
// onPressed: null,
// ),
// ),
// ],
// ),
body: Stack(
children: [
DrawerScreen(),
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ flutter:

uses-material-design: true

# To add assets to your application, add an assets section, like this:
assets:
- assets/icons/
- assets/lottie/
Expand Down

0 comments on commit 661f60e

Please sign in to comment.