Skip to content

Commit

Permalink
feat: Refactoring to HomePage and implementing AppBar. #305
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Feb 20, 2023
1 parent b067343 commit 7302107
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 9 deletions.
Binary file added assets/images/dwyl_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 50 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,55 @@ class MyApp extends StatelessWidget {
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: Scaffold(
appBar: AppBar(
title: const Text('DWYL'),
centerTitle: true,
),
body: const MyTextField()));
home: HomePage());
}
}

class HomePage extends StatefulWidget {
const HomePage({super.key});

@override
State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
bool showMenu = false;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();

@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
drawerEnableOpenDragGesture: false,
appBar: AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset("assets/images/dwyl_logo.png", fit: BoxFit.fitHeight, height: 30),
],
),
leading: Container(),
backgroundColor: Colors.black,
elevation: 0.0,
actions: [
Visibility(
maintainSize: true,
maintainAnimation: true,
maintainState: true,
visible: showMenu,
child: IconButton(
onPressed: () {
_scaffoldKey.currentState!.openEndDrawer();
},
icon: const Icon(
Icons.menu,
color: Colors.white,
),
),
)
],
),
body: const MyTextField());
}
}

Expand All @@ -46,9 +89,7 @@ class _MyTextFieldState extends State<MyTextField> {
focus ? extendsFieldText() : minimizeFieldText();
},
child: TextField(
decoration: const InputDecoration(
hintText: 'Capture what is on your mind..!.',
border: OutlineInputBorder()),
decoration: const InputDecoration(hintText: 'Capture what is on your mind..!.', border: OutlineInputBorder()),
expands: _expands,
maxLines: _maxLines,
textAlignVertical: TextAlignVertical.top,
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ flutter:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
assets:
- assets/images/

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
Expand Down

0 comments on commit 7302107

Please sign in to comment.