firewallet-mobile/lib/main.dart

144 lines
4.0 KiB
Dart
Raw Normal View History

2024-06-03 13:04:05 +10:00
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
2024-06-03 13:24:39 +10:00
title: 'Fire Wallet',
2024-06-03 13:04:05 +10:00
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
2024-06-03 13:24:39 +10:00
home: const MyHomePage(),
2024-06-03 13:04:05 +10:00
);
}
}
class MyHomePage extends StatefulWidget {
2024-06-03 13:24:39 +10:00
const MyHomePage({super.key});
2024-06-03 13:04:05 +10:00
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
2024-06-03 13:24:39 +10:00
int currentPageIndex = 0;
2024-06-03 13:04:05 +10:00
@override
Widget build(BuildContext context) {
2024-06-03 13:24:39 +10:00
final ThemeData theme = Theme.of(context);
2024-06-03 13:04:05 +10:00
return Scaffold(
2024-06-03 13:24:39 +10:00
bottomNavigationBar: NavigationBar(
onDestinationSelected: (int index) {
setState(() {
currentPageIndex = index;
});
},
selectedIndex: currentPageIndex,
destinations: const <Widget>[
NavigationDestination(
selectedIcon: Icon(Icons.home),
icon: Icon(Icons.home_outlined),
label: 'Home',
),
NavigationDestination(
icon: Icon(Icons.text_format_rounded),
label: 'Domains',
),
NavigationDestination(
icon: Icon(Icons.receipt),
label: 'Transactions',
),
],
2024-06-03 13:04:05 +10:00
),
2024-06-03 13:24:39 +10:00
body: <Widget>[
/// Home page
Card(
shadowColor: Colors.transparent,
margin: const EdgeInsets.all(8.0),
child: SizedBox.expand(
child: Center(
child: Text(
'Home page',
style: theme.textTheme.titleLarge,
),
2024-06-03 13:04:05 +10:00
),
2024-06-03 13:24:39 +10:00
),
2024-06-03 13:04:05 +10:00
),
2024-06-03 13:24:39 +10:00
/// Notifications page
const Padding(
padding: EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Card(
child: ListTile(
leading: Icon(Icons.notifications_sharp),
title: Text('Notification 1'),
subtitle: Text('This is a notification'),
),
),
Card(
child: ListTile(
leading: Icon(Icons.notifications_sharp),
title: Text('Notification 2'),
subtitle: Text('This is a notification'),
),
),
],
),
),
/// Messages page
ListView.builder(
reverse: true,
itemCount: 2,
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
return Align(
alignment: Alignment.centerRight,
child: Container(
margin: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: theme.colorScheme.primary,
borderRadius: BorderRadius.circular(8.0),
),
child: Text(
'Hello',
style: theme.textTheme.bodyLarge!
.copyWith(color: theme.colorScheme.onPrimary),
),
),
);
}
return Align(
alignment: Alignment.centerLeft,
child: Container(
margin: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: theme.colorScheme.primary,
borderRadius: BorderRadius.circular(8.0),
),
child: Text(
'Hi!',
style: theme.textTheme.bodyLarge!
.copyWith(color: theme.colorScheme.onPrimary),
),
),
);
},
),
][currentPageIndex],
2024-06-03 13:04:05 +10:00
);
}
}