mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
improve ui
This commit is contained in:
@@ -23,8 +23,7 @@ class PaneActionEntry {
|
||||
}
|
||||
|
||||
class NaviPane extends StatefulWidget {
|
||||
const NaviPane(
|
||||
{required this.paneItems,
|
||||
const NaviPane({required this.paneItems,
|
||||
required this.paneActions,
|
||||
required this.pageBuilder,
|
||||
this.initialPage = 0,
|
||||
@@ -76,14 +75,17 @@ class _NaviPaneState extends State<NaviPane>
|
||||
static const _kTopBarHeight = 48.0;
|
||||
|
||||
double get bottomBarHeight =>
|
||||
_kBottomBarHeight + MediaQuery.of(context).padding.bottom;
|
||||
_kBottomBarHeight + MediaQuery
|
||||
.of(context)
|
||||
.padding
|
||||
.bottom;
|
||||
|
||||
void onNavigatorStateChange() {
|
||||
onRebuild(context);
|
||||
}
|
||||
|
||||
void updatePage(int index) {
|
||||
if(widget.observer.routes.length > 1) {
|
||||
if (widget.observer.routes.length > 1) {
|
||||
widget.navigatorKey.currentState!.popUntil((route) => route.isFirst);
|
||||
}
|
||||
setState(() {
|
||||
@@ -112,7 +114,10 @@ class _NaviPaneState extends State<NaviPane>
|
||||
}
|
||||
|
||||
double targetFormContext(BuildContext context) {
|
||||
var width = MediaQuery.of(context).size.width;
|
||||
var width = MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width;
|
||||
double target = 0;
|
||||
if (width > changePoint) {
|
||||
target = 2;
|
||||
@@ -181,7 +186,8 @@ class _NaviPaneState extends State<NaviPane>
|
||||
return Navigator(
|
||||
observers: [widget.observer],
|
||||
key: widget.navigatorKey,
|
||||
onGenerateRoute: (settings) => AppPageRoute(
|
||||
onGenerateRoute: (settings) =>
|
||||
AppPageRoute(
|
||||
preventRebuild: false,
|
||||
isRootRoute: true,
|
||||
builder: (context) {
|
||||
@@ -224,22 +230,24 @@ class _NaviPaneState extends State<NaviPane>
|
||||
|
||||
Widget buildBottom() {
|
||||
return Material(
|
||||
textStyle: Theme.of(context).textTheme.labelSmall,
|
||||
textStyle: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
.labelSmall,
|
||||
elevation: 0,
|
||||
child: Container(
|
||||
height: _kBottomBarHeight + MediaQuery.of(context).padding.bottom,
|
||||
height: _kBottomBarHeight,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
color: Theme
|
||||
.of(context)
|
||||
.colorScheme
|
||||
.outlineVariant,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).padding.bottom,
|
||||
),
|
||||
child: Row(
|
||||
children: List<Widget>.generate(
|
||||
widget.paneItems.length,
|
||||
@@ -258,7 +266,6 @@ class _NaviPaneState extends State<NaviPane>
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -274,7 +281,10 @@ class _NaviPaneState extends State<NaviPane>
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
right: BorderSide(
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
color: Theme
|
||||
.of(context)
|
||||
.colorScheme
|
||||
.outlineVariant,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
@@ -288,10 +298,14 @@ class _NaviPaneState extends State<NaviPane>
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(height: MediaQuery.of(context).padding.top),
|
||||
SizedBox(height: MediaQuery
|
||||
.of(context)
|
||||
.padding
|
||||
.top),
|
||||
...List<Widget>.generate(
|
||||
widget.paneItems.length,
|
||||
(index) => _SideNaviWidget(
|
||||
(index) =>
|
||||
_SideNaviWidget(
|
||||
enabled: currentPage == index,
|
||||
entry: widget.paneItems[index],
|
||||
showTitle: value == 3,
|
||||
@@ -304,7 +318,8 @@ class _NaviPaneState extends State<NaviPane>
|
||||
const Spacer(),
|
||||
...List<Widget>.generate(
|
||||
widget.paneActions.length,
|
||||
(index) => _PaneActionWidget(
|
||||
(index) =>
|
||||
_PaneActionWidget(
|
||||
entry: widget.paneActions[index],
|
||||
showTitle: value == 3,
|
||||
key: ValueKey(index + widget.paneItems.length),
|
||||
@@ -325,8 +340,7 @@ class _NaviPaneState extends State<NaviPane>
|
||||
}
|
||||
|
||||
class _SideNaviWidget extends StatefulWidget {
|
||||
const _SideNaviWidget(
|
||||
{required this.enabled,
|
||||
const _SideNaviWidget({required this.enabled,
|
||||
required this.entry,
|
||||
required this.onTap,
|
||||
required this.showTitle,
|
||||
@@ -349,7 +363,9 @@ class _SideNaviWidgetState extends State<_SideNaviWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final colorScheme = Theme
|
||||
.of(context)
|
||||
.colorScheme;
|
||||
final icon =
|
||||
Icon(widget.enabled ? widget.entry.activeIcon : widget.entry.icon);
|
||||
return MouseRegion(
|
||||
@@ -408,7 +424,9 @@ class _PaneActionWidgetState extends State<_PaneActionWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final colorScheme = Theme
|
||||
.of(context)
|
||||
.colorScheme;
|
||||
final icon = Icon(widget.entry.icon);
|
||||
return MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
@@ -445,8 +463,7 @@ class _PaneActionWidgetState extends State<_PaneActionWidget> {
|
||||
}
|
||||
|
||||
class _SingleBottomNaviWidget extends StatefulWidget {
|
||||
const _SingleBottomNaviWidget(
|
||||
{required this.enabled,
|
||||
const _SingleBottomNaviWidget({required this.enabled,
|
||||
required this.entry,
|
||||
required this.onTap,
|
||||
super.key});
|
||||
@@ -517,7 +534,9 @@ class _SingleBottomNaviWidgetState extends State<_SingleBottomNaviWidget>
|
||||
|
||||
Widget buildContent() {
|
||||
final value = controller.value;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final colorScheme = Theme
|
||||
.of(context)
|
||||
.colorScheme;
|
||||
final icon =
|
||||
Icon(widget.enabled ? widget.entry.activeIcon : widget.entry.icon);
|
||||
return Center(
|
||||
@@ -684,7 +703,8 @@ class _NaviMainViewState extends State<_NaviMainView> {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (shouldShowAppBar) state.buildBottom().paddingBottom(context.padding.bottom),
|
||||
if (shouldShowAppBar) state.buildBottom().paddingBottom(
|
||||
context.padding.bottom),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user