1
0
forked from firka/firka

settings & home: use firka app bundle

fixes #61
This commit is contained in:
2025-09-13 13:36:08 +02:00
parent e84ea8c383
commit b4d87978e2
2 changed files with 198 additions and 193 deletions

View File

@@ -377,192 +377,195 @@ class _HomeScreenState extends FirkaState<HomeScreen> {
}
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
return PopScope(
canPop: canPop,
child: Scaffold(
backgroundColor: appStyle.colors.background,
body: SafeArea(
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: Stack(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
return DefaultAssetBundle(
bundle: FirkaBundle(),
child: PopScope(
canPop: canPop,
child: Scaffold(
backgroundColor: appStyle.colors.background,
body: SafeArea(
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: Stack(
children: [
Expanded(
child: RefreshConfiguration(
springDescription: SpringDescription(
mass: 1.9, stiffness: 85, damping: 16),
child: SmartScroll(
controller: _refreshController,
onLoading: _onLoading,
onRefresh: _onRefresh,
header: MaterialClassicHeader(
color: appStyle.colors.accent,
backgroundColor: appStyle.colors.background,
offset: 24,
),
physics: ClampingScrollPhysics(),
child: PageView(
controller: _pageController,
physics: ClampingScrollPhysics(),
onPageChanged: (index) {
HapticFeedback.heavyImpact();
if (forcedNav > 0) {
forcedNav--;
if (previousPages.isEmpty) {
canPop = true;
}
return;
}
setState(() {
previousPages.add(page);
canPop = false;
page = HomePage.values[index];
});
},
children: [
HomeSubPage(
HomePage.home,
widget.data,
widget.updateNotifier,
widget.updateFinishedNotifier,
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: RefreshConfiguration(
springDescription: SpringDescription(
mass: 1.9, stiffness: 85, damping: 16),
child: SmartScroll(
controller: _refreshController,
onLoading: _onLoading,
onRefresh: _onRefresh,
header: MaterialClassicHeader(
color: appStyle.colors.accent,
backgroundColor: appStyle.colors.background,
offset: 24,
),
HomeSubPage(
HomePage.grades,
widget.data,
widget.updateNotifier,
widget.updateFinishedNotifier,
),
HomeSubPage(
HomePage.timetable,
widget.data,
widget.updateNotifier,
widget.updateFinishedNotifier,
),
],
))),
),
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
appStyle.colors.background,
appStyle.colors.background.withValues(alpha: 0.0),
],
stops: const [0.0, 1.0],
physics: ClampingScrollPhysics(),
child: PageView(
controller: _pageController,
physics: ClampingScrollPhysics(),
onPageChanged: (index) {
HapticFeedback.heavyImpact();
if (forcedNav > 0) {
forcedNav--;
if (previousPages.isEmpty) {
canPop = true;
}
return;
}
setState(() {
previousPages.add(page);
canPop = false;
page = HomePage.values[index];
});
},
children: [
HomeSubPage(
HomePage.home,
widget.data,
widget.updateNotifier,
widget.updateFinishedNotifier,
),
HomeSubPage(
HomePage.grades,
widget.data,
widget.updateNotifier,
widget.updateFinishedNotifier,
),
HomeSubPage(
HomePage.timetable,
widget.data,
widget.updateNotifier,
widget.updateFinishedNotifier,
),
],
))),
),
),
width: MediaQuery.of(context).size.width,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 55, vertical: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Home Button
BottomNavIconWidget(() {
if (page != HomePage.home) {
_pageController.animateToPage(
HomePage.home.index,
duration: Duration(milliseconds: 175),
curve: Curves.easeInOut,
);
}
},
page == HomePage.home,
page == HomePage.home
? Majesticon.homeSolid
: Majesticon.homeLine,
widget.data.l10n.home,
page == HomePage.home
? appStyle.colors.accent
: appStyle.colors.secondary,
appStyle.colors.textPrimary),
// Grades Button
BottomNavIconWidget(() {
if (page != HomePage.grades) {
_pageController.animateToPage(
HomePage.grades.index,
duration: Duration(milliseconds: 175),
curve: Curves.easeInOut,
);
}
},
page == HomePage.grades,
page == HomePage.grades
? Majesticon.bookmarkSolid
: Majesticon.bookmarkLine,
widget.data.l10n.grades,
page == HomePage.grades
? appStyle.colors.accent
: appStyle.colors.secondary,
appStyle.colors.textPrimary),
// Timetable Button
BottomNavIconWidget(() {
if (page != HomePage.timetable) {
_pageController.animateToPage(
HomePage.timetable.index,
duration: Duration(milliseconds: 175),
curve: Curves.easeInOut,
);
}
},
page == HomePage.timetable,
page == HomePage.timetable
? Majesticon.calendarSolid
: Majesticon.calendarLine,
widget.data.l10n.timetable,
page == HomePage.timetable
? appStyle.colors.accent
: appStyle.colors.secondary,
appStyle.colors.textPrimary),
// More Button
BottomNavIconWidget(
() {
HapticFeedback.lightImpact();
showExtrasBottomSheet(context, widget.data);
},
false,
Majesticon.globeEarthLine,
widget.data.l10n.other,
appStyle.colors.secondary,
appStyle.colors.textPrimary,
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
appStyle.colors.background,
appStyle.colors.background
.withValues(alpha: 0.0),
],
stops: const [0.0, 1.0],
),
],
),
width: MediaQuery.of(context).size.width,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 55, vertical: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Home Button
BottomNavIconWidget(() {
if (page != HomePage.home) {
_pageController.animateToPage(
HomePage.home.index,
duration: Duration(milliseconds: 175),
curve: Curves.easeInOut,
);
}
},
page == HomePage.home,
page == HomePage.home
? Majesticon.homeSolid
: Majesticon.homeLine,
widget.data.l10n.home,
page == HomePage.home
? appStyle.colors.accent
: appStyle.colors.secondary,
appStyle.colors.textPrimary),
// Grades Button
BottomNavIconWidget(() {
if (page != HomePage.grades) {
_pageController.animateToPage(
HomePage.grades.index,
duration: Duration(milliseconds: 175),
curve: Curves.easeInOut,
);
}
},
page == HomePage.grades,
page == HomePage.grades
? Majesticon.bookmarkSolid
: Majesticon.bookmarkLine,
widget.data.l10n.grades,
page == HomePage.grades
? appStyle.colors.accent
: appStyle.colors.secondary,
appStyle.colors.textPrimary),
// Timetable Button
BottomNavIconWidget(() {
if (page != HomePage.timetable) {
_pageController.animateToPage(
HomePage.timetable.index,
duration: Duration(milliseconds: 175),
curve: Curves.easeInOut,
);
}
},
page == HomePage.timetable,
page == HomePage.timetable
? Majesticon.calendarSolid
: Majesticon.calendarLine,
widget.data.l10n.timetable,
page == HomePage.timetable
? appStyle.colors.accent
: appStyle.colors.secondary,
appStyle.colors.textPrimary),
// More Button
BottomNavIconWidget(
() {
HapticFeedback.lightImpact();
showExtrasBottomSheet(context, widget.data);
},
false,
Majesticon.globeEarthLine,
widget.data.l10n.other,
appStyle.colors.secondary,
appStyle.colors.textPrimary,
),
],
),
),
),
),
],
),
toast ?? SizedBox(),
],
),
toast ?? SizedBox(),
],
),
),
),
),
),
onPopInvokedWithResult: (_, __) => {
if (previousPages.isNotEmpty && page != previousPages.last)
{
setState(() {
page = previousPages.removeLast();
onPopInvokedWithResult: (_, __) => {
if (previousPages.isNotEmpty && page != previousPages.last)
{
setState(() {
page = previousPages.removeLast();
forcedNav++;
_pageController.animateToPage(
page.index,
duration: Duration(milliseconds: 175),
curve: Curves.easeInOut,
);
canPop = previousPages.isEmpty;
})
}
},
);
forcedNav++;
_pageController.animateToPage(
page.index,
duration: Duration(milliseconds: 175),
curve: Curves.easeInOut,
);
canPop = previousPages.isEmpty;
})
}
},
));
}
@override

View File

@@ -668,25 +668,27 @@ class _SettingsScreenState extends FirkaState<SettingsScreen> {
Widget build(BuildContext context) {
var body = createWidgetTree(widget.items.values, widget.data.settings);
return Scaffold(
backgroundColor: appStyle.colors.background,
body: SafeArea(
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: Stack(
children: [
Padding(
padding: EdgeInsetsGeometry.all(20),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: body)),
)
],
return DefaultAssetBundle(
bundle: FirkaBundle(),
child: Scaffold(
backgroundColor: appStyle.colors.background,
body: SafeArea(
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: Stack(
children: [
Padding(
padding: EdgeInsetsGeometry.all(20),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: body)),
)
],
),
),
),
),
),
);
));
}
}