feat: Add navigation and data entry page
This commit is contained in:
commit
d1b97dc621
68 changed files with 1769 additions and 0 deletions
87
lib/data_entry/view.dart
Normal file
87
lib/data_entry/view.dart
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class DataEntryPage extends StatelessWidget {
|
||||
const DataEntryPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
SizedBox.fromSize(size: const Size.fromHeight(32)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(32, 0, 32, 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: const Icon(Icons.account_balance),
|
||||
),
|
||||
),
|
||||
SizedBox.fromSize(size: const Size.fromWidth(32)),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: const Icon(Icons.add_a_photo),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(32, 16, 32, 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 10,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: const Icon(Icons.account_balance),
|
||||
),
|
||||
),
|
||||
SizedBox.fromSize(size: const Size.fromWidth(32)),
|
||||
Expanded(
|
||||
flex: 10,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: const Icon(Icons.add_a_photo),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
getCurrentDate(),
|
||||
style: const TextStyle(
|
||||
fontSize: 54,
|
||||
fontWeight: FontWeight.w200,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
String getCurrentDate() {
|
||||
DateTime now = DateTime.now();
|
||||
DateTime date = DateTime(now.year, now.month, now.day);
|
||||
return DateFormat.yMd('de_CH').format(date);
|
||||
}
|
||||
}
|
||||
0
lib/history/view.dart
Normal file
0
lib/history/view.dart
Normal file
24
lib/main.dart
Normal file
24
lib/main.dart
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/date_symbol_data_local.dart';
|
||||
import 'navigator/view.dart';
|
||||
|
||||
void main() {
|
||||
initializeDateFormatting("de_CH", null);
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: const SafeArea(child: NavigatorPage()),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
lib/navigator/view.dart
Normal file
44
lib/navigator/view.dart
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:migrainetracker/data_entry/view.dart';
|
||||
|
||||
class NavigatorPage extends StatefulWidget {
|
||||
const NavigatorPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<NavigatorPage> createState() => _NavigatorPageState();
|
||||
}
|
||||
|
||||
class _NavigatorPageState extends State<NavigatorPage> {
|
||||
int currentPageIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Migraine Tracker"),
|
||||
),
|
||||
bottomNavigationBar: NavigationBar(
|
||||
destinations: const <Widget>[
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.explore),
|
||||
label: 'Today',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.commute),
|
||||
label: 'Stats',
|
||||
),
|
||||
],
|
||||
selectedIndex: currentPageIndex,
|
||||
onDestinationSelected: (int index) {
|
||||
setState(() {
|
||||
currentPageIndex = index;
|
||||
});
|
||||
},
|
||||
),
|
||||
body: <Widget>[
|
||||
const DataEntryPage(),
|
||||
const Placeholder(),
|
||||
][currentPageIndex],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue