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

View File

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