forked from firka/firka
fix: navbar design
This commit is contained in:
@@ -41,57 +41,33 @@ class ShellWithNavBar extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(55, 0, 55, 12),
|
||||
padding: const EdgeInsets.fromLTRB(55, 16, 55, 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
BottomNavIconWidget(
|
||||
() {
|
||||
if (currentIndex != 0) {
|
||||
navigationShell.goBranch(0);
|
||||
}
|
||||
},
|
||||
currentIndex == 0,
|
||||
currentIndex == 0
|
||||
? Majesticon.homeSolid
|
||||
: Majesticon.homeLine,
|
||||
data.l10n.home,
|
||||
currentIndex == 0
|
||||
? appStyle.colors.accent
|
||||
: appStyle.colors.secondary,
|
||||
appStyle.colors.textPrimary,
|
||||
),
|
||||
BottomNavIconWidget(
|
||||
() {
|
||||
if (currentIndex != 1) {
|
||||
navigationShell.goBranch(1);
|
||||
}
|
||||
},
|
||||
currentIndex == 1,
|
||||
currentIndex == 1
|
||||
? Majesticon.bookmarkSolid
|
||||
: Majesticon.bookmarkLine,
|
||||
data.l10n.grades,
|
||||
currentIndex == 1
|
||||
? appStyle.colors.accent
|
||||
: appStyle.colors.secondary,
|
||||
appStyle.colors.textPrimary,
|
||||
),
|
||||
BottomNavIconWidget(
|
||||
() {
|
||||
if (currentIndex != 2) {
|
||||
navigationShell.goBranch(2);
|
||||
}
|
||||
},
|
||||
currentIndex == 2,
|
||||
currentIndex == 2
|
||||
? Majesticon.calendarSolid
|
||||
: Majesticon.calendarLine,
|
||||
data.l10n.timetable,
|
||||
currentIndex == 2
|
||||
? appStyle.colors.accent
|
||||
: appStyle.colors.secondary,
|
||||
appStyle.colors.textPrimary,
|
||||
...[
|
||||
(data.l10n.home, Majesticon.homeSolid, Majesticon.homeLine),
|
||||
(
|
||||
data.l10n.grades,
|
||||
Majesticon.bookmarkSolid,
|
||||
Majesticon.bookmarkLine,
|
||||
),
|
||||
(
|
||||
data.l10n.timetable,
|
||||
Majesticon.calendarSolid,
|
||||
Majesticon.calendarLine,
|
||||
),
|
||||
].indexed.map(
|
||||
(nav) => BottomNavIconWidget(
|
||||
() {
|
||||
if (currentIndex != nav.$1) {
|
||||
navigationShell.goBranch(nav.$1);
|
||||
}
|
||||
},
|
||||
currentIndex == nav.$1,
|
||||
currentIndex == nav.$1 ? nav.$2.$2 : nav.$2.$3,
|
||||
nav.$2.$1,
|
||||
),
|
||||
),
|
||||
BottomNavIconWidget(
|
||||
() {
|
||||
@@ -102,8 +78,6 @@ class ShellWithNavBar extends StatelessWidget {
|
||||
? data.profilePicture!
|
||||
: Majesticon.menuLine,
|
||||
data.l10n.other,
|
||||
appStyle.colors.secondary,
|
||||
appStyle.colors.textPrimary,
|
||||
isProfilePicture: data.profilePicture != null,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -9,17 +9,13 @@ class BottomNavIconWidget extends StatelessWidget {
|
||||
final bool active;
|
||||
final dynamic icon;
|
||||
final String text;
|
||||
final Color iconColor;
|
||||
final Color textColor;
|
||||
final bool isProfilePicture;
|
||||
|
||||
const BottomNavIconWidget(
|
||||
this.onTap,
|
||||
this.active,
|
||||
this.icon,
|
||||
this.text,
|
||||
this.iconColor,
|
||||
this.textColor, {
|
||||
this.text, {
|
||||
this.isProfilePicture = false,
|
||||
super.key,
|
||||
});
|
||||
@@ -33,43 +29,40 @@ class BottomNavIconWidget extends StatelessWidget {
|
||||
HapticFeedback.lightImpact();
|
||||
onTap();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (isProfilePicture && icon != null)
|
||||
Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
image: MemoryImage(icon as Uint8List),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (isProfilePicture && icon != null)
|
||||
Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
image: MemoryImage(icon as Uint8List),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
)
|
||||
else
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
icon as Uint8List,
|
||||
color: iconColor,
|
||||
size: 24,
|
||||
).build(context),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
text,
|
||||
style: active
|
||||
? appStyle.fonts.B_12SB.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
)
|
||||
: appStyle.fonts.B_12R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
icon as Uint8List,
|
||||
color: active
|
||||
? appStyle.colors.accent
|
||||
: appStyle.colors.secondary.withAlpha(128),
|
||||
size: 24,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
text,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: active
|
||||
? appStyle.colors.textPrimary
|
||||
: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user