mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: Add back button on app bars of secondary views
This commit is contained in:
parent
3e6e94c098
commit
2a2bb8212f
@ -37,12 +37,29 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
|||||||
pinned: true,
|
pinned: true,
|
||||||
floating: true,
|
floating: true,
|
||||||
snap: false,
|
snap: false,
|
||||||
title: I18nText('appSelectorView.viewTitle'),
|
title: I18nText(
|
||||||
|
'appSelectorView.viewTitle',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
bottom: PreferredSize(
|
bottom: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(64.0),
|
preferredSize: const Size.fromHeight(64.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 8.0, horizontal: 12.0),
|
vertical: 8.0,
|
||||||
|
horizontal: 12.0,
|
||||||
|
),
|
||||||
child: SearchBar(
|
child: SearchBar(
|
||||||
showSelectIcon: false,
|
showSelectIcon: false,
|
||||||
hintText: FlutterI18n.translate(
|
hintText: FlutterI18n.translate(
|
||||||
@ -66,8 +83,8 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
|||||||
: model.apps.isEmpty
|
: model.apps.isEmpty
|
||||||
? const AppSkeletonLoader()
|
? const AppSkeletonLoader()
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 80).add(
|
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
||||||
const EdgeInsets.symmetric(horizontal: 12.0)),
|
.copyWith(bottom: 80),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: model
|
children: model
|
||||||
.getFilteredApps(_query)
|
.getFilteredApps(_query)
|
||||||
|
@ -28,6 +28,7 @@ class HomeView extends StatelessWidget {
|
|||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
CustomSliverAppBar(
|
CustomSliverAppBar(
|
||||||
|
isMainView: true,
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'homeView.widgetTitle',
|
'homeView.widgetTitle',
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -28,6 +28,7 @@ class PatcherView extends StatelessWidget {
|
|||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
CustomSliverAppBar(
|
CustomSliverAppBar(
|
||||||
|
isMainView: true,
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'patcherView.widgetTitle',
|
'patcherView.widgetTitle',
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -39,12 +39,29 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
pinned: true,
|
pinned: true,
|
||||||
floating: true,
|
floating: true,
|
||||||
snap: false,
|
snap: false,
|
||||||
title: I18nText('patchesSelectorView.viewTitle'),
|
title: I18nText(
|
||||||
|
'patchesSelectorView.viewTitle',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
bottom: PreferredSize(
|
bottom: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(64.0),
|
preferredSize: const Size.fromHeight(64.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 8.0, horizontal: 12.0),
|
vertical: 8.0,
|
||||||
|
horizontal: 12.0,
|
||||||
|
),
|
||||||
child: SearchBar(
|
child: SearchBar(
|
||||||
showSelectIcon: true,
|
showSelectIcon: true,
|
||||||
hintText: FlutterI18n.translate(
|
hintText: FlutterI18n.translate(
|
||||||
@ -76,8 +93,8 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 80)
|
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
||||||
.add(const EdgeInsets.symmetric(horizontal: 12.0)),
|
.copyWith(bottom: 80),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: model
|
children: model
|
||||||
.getQueriedPatches(_query)
|
.getQueriedPatches(_query)
|
||||||
|
@ -24,6 +24,7 @@ class SettingsView extends StatelessWidget {
|
|||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
CustomSliverAppBar(
|
CustomSliverAppBar(
|
||||||
|
isMainView: true,
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'settingsView.widgetTitle',
|
'settingsView.widgetTitle',
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -4,12 +4,14 @@ class CustomSliverAppBar extends StatelessWidget {
|
|||||||
final Widget title;
|
final Widget title;
|
||||||
final List<Widget>? actions;
|
final List<Widget>? actions;
|
||||||
final PreferredSizeWidget? bottom;
|
final PreferredSizeWidget? bottom;
|
||||||
|
final bool isMainView;
|
||||||
|
|
||||||
const CustomSliverAppBar({
|
const CustomSliverAppBar({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.title,
|
required this.title,
|
||||||
this.actions,
|
this.actions,
|
||||||
this.bottom,
|
this.bottom,
|
||||||
|
this.isMainView = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -19,16 +21,28 @@ class CustomSliverAppBar extends StatelessWidget {
|
|||||||
snap: false,
|
snap: false,
|
||||||
floating: false,
|
floating: false,
|
||||||
expandedHeight: 100.0,
|
expandedHeight: 100.0,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: !isMainView,
|
||||||
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
|
titlePadding: EdgeInsets.only(
|
||||||
|
bottom: 14.0,
|
||||||
|
left: isMainView ? 20.0 : 55.0,
|
||||||
|
),
|
||||||
|
title: title,
|
||||||
|
),
|
||||||
|
leading: isMainView
|
||||||
|
? null
|
||||||
|
: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
backgroundColor: MaterialStateColor.resolveWith(
|
backgroundColor: MaterialStateColor.resolveWith(
|
||||||
(states) => states.contains(MaterialState.scrolledUnder)
|
(states) => states.contains(MaterialState.scrolledUnder)
|
||||||
? Theme.of(context).colorScheme.surface
|
? Theme.of(context).colorScheme.surface
|
||||||
: Theme.of(context).canvasColor,
|
: Theme.of(context).canvasColor,
|
||||||
),
|
),
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
|
||||||
titlePadding: const EdgeInsets.only(bottom: 16.0, left: 20.0),
|
|
||||||
title: title,
|
|
||||||
),
|
|
||||||
actions: actions,
|
actions: actions,
|
||||||
bottom: bottom,
|
bottom: bottom,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user