Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Designed user interfaces : II #4

Merged
merged 5 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import './pages/home_page.dart';
import './pages/qr_result_page.dart';
import './pages/signup_page.dart';
import './pages/opening_screen.dart';

import './pages/login_history_page.dart';
import './pages/settings_page.dart';
import './pages/welcome_pages/welcome_screen1.dart';
import './pages/welcome_pages/welcome_screen2.dart';
import './pages/welcome_pages/welcome_screen3.dart';
Expand All @@ -30,7 +31,12 @@ class MyApp extends StatelessWidget {
foregroundColor: Colors.black,
elevation: 0,
centerTitle: true,
)
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: Colors.grey.shade200,
selectedItemColor: Colors.black,
unselectedItemColor: Colors.black,
),
),
darkTheme: ThemeData.dark().copyWith(
brightness: Brightness.dark,
Expand All @@ -41,7 +47,12 @@ class MyApp extends StatelessWidget {
foregroundColor: Colors.white,
elevation: 0,
centerTitle: true,
)
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: Colors.grey.shade900,
selectedItemColor: Colors.white,
unselectedItemColor: Colors.white,
),
),
themeMode: ThemeMode.system,

Expand All @@ -51,7 +62,7 @@ class MyApp extends StatelessWidget {
WidgetBuilder builder;
switch(settings.name){
case '/home':
builder = (context) => const HomePage();
builder = (context) => HomePage();
break;
case '/qrcode-reader':
builder = (context) => const QrReaderPage();
Expand All @@ -71,8 +82,14 @@ class MyApp extends StatelessWidget {
case '/welcome3':
builder = (context) => const WelcomeScreen3();
break;
case '/history':
builder = (context) => const LoginHistoryPage();
break;
case '/settings':
builder = (context) => const SettingsPage();
break;
default:
builder = (context) => const HomePage();
builder = (context) => HomePage();
}
return MaterialPageRoute(builder: builder, settings: settings);
}),
Expand Down
138 changes: 84 additions & 54 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import 'package:flutter/material.dart';

import '../widgets/add_new_dialog.dart';

class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
HomePage({Key? key}) : super(key: key);

final data = {"Name": "Test User",
"Email Address": "test@iblock.com",
"Date of Birth" : "01/01/2000",
"Country" : "United States",
"Mobile Number" : "+1 123 456 7890",
"Gender" : "Male"
};

@override
Widget build(BuildContext context) {
Expand All @@ -17,57 +27,66 @@ class HomePage extends StatelessWidget {
width: 100,
height: 100,
),
const Padding(
padding: EdgeInsets.all(10),
Padding(
padding: const EdgeInsets.all(10),
child: Text(
"Test User",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
data["Name"]!,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
)),
Table(
children: const [
TableRow(children: [
Padding(
padding: EdgeInsets.all(10),
child: Text("Email Address",
style: TextStyle(fontWeight: FontWeight.bold))),
Padding(
padding: EdgeInsets.all(10),
child: Text("test@iblock.com"))
]),
TableRow(children: [
Padding(
padding: EdgeInsets.all(10),
child: Text("Date of Birth",
style: TextStyle(fontWeight: FontWeight.bold))),
Padding(
padding: EdgeInsets.all(10), child: Text("01/01/2000"))
]),
TableRow(children: [
Padding(
padding: EdgeInsets.all(10),
child: Text("Country",
style: TextStyle(fontWeight: FontWeight.bold))),
Padding(
padding: EdgeInsets.all(10),
child: Text("United States"))
]),
TableRow(children: [
Padding(
padding: EdgeInsets.all(10),
child: Text("Mobile Number",
style: TextStyle(fontWeight: FontWeight.bold))),
Padding(
padding: EdgeInsets.all(10),
child: Text("+1 123 456 7890"))
]),
TableRow(children: [
Padding(
padding: EdgeInsets.all(10),
child: Text("Gender",
style: TextStyle(fontWeight: FontWeight.bold))),
Padding(padding: EdgeInsets.all(10), child: Text("Male"))
]),
],
children:
data.entries.map((e) => TableRow(children: [
Padding(
padding: const EdgeInsets.all(10),
child: Text(e.key,
style: const TextStyle(fontWeight: FontWeight.bold))),
Padding(
padding: const EdgeInsets.all(10), child: Text(e.value))
])).toList()
// const [
// TableRow(children: [
// Padding(
// padding: EdgeInsets.all(10),
// child: Text("Email Address",
// style: TextStyle(fontWeight: FontWeight.bold))),
// Padding(
// padding: EdgeInsets.all(10),
// child: Text("test@iblock.com"))
// ]),
// TableRow(children: [
// Padding(
// padding: EdgeInsets.all(10),
// child: Text("Date of Birth",
// style: TextStyle(fontWeight: FontWeight.bold))),
// Padding(
// padding: EdgeInsets.all(10), child: Text("01/01/2000"))
// ]),
// TableRow(children: [
// Padding(
// padding: EdgeInsets.all(10),
// child: Text("Country",
// style: TextStyle(fontWeight: FontWeight.bold))),
// Padding(
// padding: EdgeInsets.all(10),
// child: Text("United States"))
// ]),
// TableRow(children: [
// Padding(
// padding: EdgeInsets.all(10),
// child: Text("Mobile Number",
// style: TextStyle(fontWeight: FontWeight.bold))),
// Padding(
// padding: EdgeInsets.all(10),
// child: Text("+1 123 456 7890"))
// ]),
// TableRow(children: [
// Padding(
// padding: EdgeInsets.all(10),
// child: Text("Gender",
// style: TextStyle(fontWeight: FontWeight.bold))),
// Padding(padding: EdgeInsets.all(10), child: Text("Male"))
// ]),
// ],
)
],
),
Expand All @@ -91,14 +110,25 @@ class HomePage extends StatelessWidget {
label: 'New',
),
BottomNavigationBarItem(
icon: Icon(Icons.light_mode),
label: 'Theme',
icon: Icon(Icons.settings),
label: 'Settings',
),
],
currentIndex: 0,
selectedItemColor: Colors.blue,
onTap: (int index) {
print(index);
switch (index) {
case 0:
Navigator.pushNamed(context, '/history');
break;
case 1:
showDialog(
context: context,
builder: (context) => const AddNewDialog()
);
break;
case 2:
Navigator.pushNamed(context, '/settings');
break;
}
},
),
);
Expand Down
15 changes: 15 additions & 0 deletions lib/pages/login_history_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

class LoginHistoryPage extends StatelessWidget {
const LoginHistoryPage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Login History'),
),
body: const Center(child: Text("Login History"),),
);
}
}
15 changes: 15 additions & 0 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

class SettingsPage extends StatelessWidget {
const SettingsPage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Settings'),
),
body: const Center(child: Text("Settings"),),
);
}
}
14 changes: 7 additions & 7 deletions lib/pages/signup_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class SignUpPage extends StatelessWidget {
'Sign Up',
style: Theme.of(context).textTheme.titleLarge,
)),
const TextInputField('Full Name'),
const TextInputField('Email'),
const TextInputField('Date of Birth'),
const TextInputField('Country'),
const TextInputField('Mobile Number'),
const TextInputField('Gender'),
TextInputField('Full Name'),
TextInputField('Email'),
TextInputField('Date of Birth'),
TextInputField('Country'),
TextInputField('Mobile Number'),
TextInputField('Gender'),
const SizedBox(height: 30,),
Button('Sign up', onPressed: (){}),
const SizedBox(height: 20,),
Expand All @@ -56,7 +56,7 @@ class SignUpPage extends StatelessWidget {
builder: (context) {
return AlertDialog(
title: const Text('Recover Account'),
content: const TextInputField('Enter recovery phrase'),
content: TextInputField('Enter recovery phrase'),
actions: [
TextButton(onPressed: () => Navigator.pop(context), child: const Text('Cancel')),
ElevatedButton(onPressed: () => Navigator.pop(context), child: const Text('Submit'))
Expand Down
34 changes: 34 additions & 0 deletions lib/widgets/add_new_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import 'package:iblock/widgets/forms/text_input_field.dart';

class AddNewDialog extends StatelessWidget {
const AddNewDialog({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Add New Entry'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextInputField("Property Name", padding: const EdgeInsets.all(8),),
TextInputField("Property Value", padding: const EdgeInsets.all(8),),
],
),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text('Cancel'),
),
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text('Add'),
),
],
);
}
}
5 changes: 4 additions & 1 deletion lib/widgets/forms/text_input_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import 'package:flutter/material.dart';

class TextInputField extends StatelessWidget {
final String label;
const TextInputField(this.label, {Key? key}) : super(key: key);
EdgeInsets padding ;

TextInputField(this.label, {Key? key, this.padding = const EdgeInsets.only(top: 8, bottom: 8, left: 30, right: 30)}) : super(key: key);

@override
Widget build(BuildContext context) {
return Padding(
Expand Down