Skip to content

Commit b0f49c4

Browse files
committed
Fix colours, lighten and darken does not alter the alpha values, update darkTheme colours, add widgets
1 parent c6c74fc commit b0f49c4

File tree

10 files changed

+731
-435
lines changed

10 files changed

+731
-435
lines changed

lib/configs/colours.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ final colours = [
6060
];
6161

6262
Color lighten(Color color, {double factor = 0.2}) => Color.fromARGB(
63-
color.alpha + ((255 - color.alpha) * factor).toInt(),
63+
color.alpha,
6464
color.red + ((255 - color.red) * factor).toInt(),
6565
color.green + ((255 - color.green) * factor).toInt(),
6666
color.blue + ((255 - color.blue) * factor).toInt(),
6767
);
6868

6969
Color darken(Color color, {double factor = 0.2}) => Color.fromARGB(
70-
(color.alpha * (1 - factor)).toInt(),
70+
color.alpha,
7171
(color.red * (1 - factor)).toInt(),
7272
(color.green * (1 - factor)).toInt(),
7373
(color.blue * (1 - factor)).toInt(),

lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import './pages/home.page.dart';
55
import './models/user.dart';
66
import './models/transfer.dart';
77
import './utils/sqlite.dart';
8+
import './configs/colours.dart';
89

910
void main() async {
1011
WidgetsFlutterBinding.ensureInitialized();
@@ -27,7 +28,7 @@ void main() async {
2728
),
2829
),
2930
darkTheme: ThemeData(
30-
primaryColorLight: Colors.black87,
31+
primaryColorLight: lighten(Colors.black, factor: 0.05),
3132
primaryColorDark: Colors.white,
3233
fontFamily: GoogleFonts.raleway().fontFamily,
3334
iconTheme: const IconThemeData(

lib/pages/home.page.dart

Lines changed: 87 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
import 'dart:ui';
2+
13
import 'package:banking_app/configs/colours.dart';
4+
import 'package:banking_app/widgets/clipper.dart';
5+
import 'package:floating_bottom_navigation_bar/floating_bottom_navigation_bar.dart';
26
import 'package:flutter/material.dart';
37
import 'package:provider/provider.dart';
48

@@ -24,21 +28,61 @@ class _HomePageState extends State<HomePage> {
2428
@override
2529
Widget build(BuildContext context) {
2630
return Scaffold(
27-
backgroundColor: lighten(Theme.of(context).primaryColorLight),
28-
appBar: AppBar(
29-
title: Text(
30-
"Banking",
31-
style: TextStyle(
32-
color: Theme.of(context).primaryColorDark,
31+
backgroundColor:
32+
MediaQuery.of(context).platformBrightness == Brightness.dark
33+
? lighten(Theme.of(context).primaryColorLight, factor: 0.15)
34+
: darken(Theme.of(context).primaryColorLight, factor: 0.05),
35+
// appBar: AppBar(
36+
// title: Text(
37+
// "Banking",
38+
// style: TextStyle(
39+
// color: Theme.of(context).primaryColorDark,
40+
// ),
41+
// ),
42+
// shadowColor: Colors.black.withOpacity(0.2),
43+
// centerTitle: true,
44+
// backgroundColor:
45+
// lighten(Theme.of(context).primaryColorLight, factor: 0.1),
46+
// ),
47+
body: Stack(
48+
children: [
49+
Container(
50+
transform: Matrix4.translationValues(0.0, -65.0, 0.0),
51+
child: ClipPath(
52+
clipper: BgClipper$(),
53+
child: Container(
54+
color: Colors.black.withOpacity(0.125),
55+
),
56+
),
3357
),
34-
),
35-
shadowColor: Colors.black.withOpacity(0.2),
36-
centerTitle: true,
37-
backgroundColor:
38-
lighten(Theme.of(context).primaryColorLight, factor: 0.1),
39-
),
40-
body: _bnbSelected == 0
41-
? MultiProvider(
58+
BackdropFilter(
59+
filter: ImageFilter.blur(sigmaX: 7, sigmaY: 7),
60+
child: Container(
61+
transform: Matrix4.translationValues(0.0, -65.0, 0.0),
62+
// color: Colors.white.withOpacity(0.25),
63+
),
64+
),
65+
Container(
66+
transform: Matrix4.translationValues(0.0, -65.0, 0.0),
67+
child: ClipPath(
68+
clipper: BgClipper$(),
69+
child: Container(
70+
color: lighten(Theme.of(context).primaryColorLight),
71+
),
72+
),
73+
),
74+
Center(
75+
child: Icon(
76+
Icons.monetization_on,
77+
size: 125,
78+
color: MediaQuery.of(context).platformBrightness ==
79+
Brightness.light
80+
? darken(Theme.of(context).primaryColorLight, factor: 0.15)
81+
: lighten(Theme.of(context).primaryColorLight),
82+
),
83+
),
84+
if (_bnbSelected == 0) ...[
85+
MultiProvider(
4286
providers: [
4387
ChangeNotifierProvider.value(
4488
value: widget.transfers,
@@ -47,36 +91,43 @@ class _HomePageState extends State<HomePage> {
4791
child: HomePageHome(
4892
users: widget.users,
4993
),
94+
),
95+
] else if (_bnbSelected == 1) ...[
96+
MultiProvider(
97+
providers: [
98+
ChangeNotifierProvider.value(
99+
value: widget.users,
100+
),
101+
ChangeNotifierProvider.value(
102+
value: widget.transfers,
103+
),
104+
],
105+
child: const HomePageViewUsers(),
50106
)
51-
: _bnbSelected == 1
52-
? MultiProvider(
53-
providers: [
54-
ChangeNotifierProvider.value(
55-
value: widget.users,
56-
),
57-
ChangeNotifierProvider.value(
58-
value: widget.transfers,
59-
),
60-
],
61-
child: const HomePageViewUsers(),
62-
)
63-
: Container(),
64-
bottomNavigationBar: BottomNavigationBar(
107+
],
108+
],
109+
),
110+
extendBody: true,
111+
bottomNavigationBar: FloatingNavbar(
112+
elevation: 30,
113+
borderRadius: 20,
114+
selectedBackgroundColor:
115+
lighten(Theme.of(context).primaryColorLight, factor: 0.4),
65116
backgroundColor:
66-
lighten(Theme.of(context).primaryColorLight, factor: 0.1),
117+
lighten(Theme.of(context).primaryColorLight, factor: 0.3),
67118
selectedItemColor: Theme.of(context).primaryColorDark,
68119
unselectedItemColor:
69120
Theme.of(context).primaryColorDark.withOpacity(0.5),
70121
currentIndex: _bnbSelected,
71122
onTap: (value) => setState(() => _bnbSelected = value),
72-
items: const [
73-
BottomNavigationBarItem(
74-
icon: Icon(Icons.home),
75-
label: "Home",
123+
items: [
124+
FloatingNavbarItem(
125+
icon: Icons.home,
126+
title: "Home",
76127
),
77-
BottomNavigationBarItem(
78-
icon: Icon(Icons.list),
79-
label: "View Users",
128+
FloatingNavbarItem(
129+
icon: Icons.list,
130+
title: "View Users",
80131
),
81132
],
82133
),

0 commit comments

Comments
 (0)