re add calculator page
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:convert';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:mileograph_flutter/services/authservice.dart';
|
||||||
import 'package:mileograph_flutter/services/api_service.dart';
|
import 'package:mileograph_flutter/services/api_service.dart';
|
||||||
import 'package:mileograph_flutter/services/endpoint_service.dart';
|
import 'package:mileograph_flutter/services/endpoint_service.dart';
|
||||||
import 'package:mileograph_flutter/services/data_service.dart';
|
import 'package:mileograph_flutter/services/data_service.dart';
|
||||||
@@ -174,6 +175,9 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final endpointService = context.watch<EndpointService>();
|
final endpointService = context.watch<EndpointService>();
|
||||||
|
final loggedIn = context.select<AuthService, bool>(
|
||||||
|
(auth) => auth.isLoggedIn,
|
||||||
|
);
|
||||||
if (!endpointService.isLoaded) {
|
if (!endpointService.isLoaded) {
|
||||||
return const Scaffold(
|
return const Scaffold(
|
||||||
body: Center(child: CircularProgressIndicator()),
|
body: Center(child: CircularProgressIndicator()),
|
||||||
@@ -251,97 +255,99 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
'Current: ${endpointService.baseUrl}',
|
'Current: ${endpointService.baseUrl}',
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
if (loggedIn) ...[
|
||||||
Text(
|
const SizedBox(height: 32),
|
||||||
'Account',
|
Text(
|
||||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
'Account',
|
||||||
fontWeight: FontWeight.w700,
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||||
),
|
fontWeight: FontWeight.w700,
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
'Change your password for this account.',
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
Form(
|
|
||||||
key: _passwordFormKey,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
controller: _currentPasswordController,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Current password',
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
),
|
),
|
||||||
obscureText: true,
|
|
||||||
enableSuggestions: false,
|
|
||||||
autocorrect: false,
|
|
||||||
autofillHints: const [AutofillHints.password],
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Please enter your current password.';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
TextFormField(
|
|
||||||
controller: _newPasswordController,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'New password',
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
),
|
|
||||||
obscureText: true,
|
|
||||||
enableSuggestions: false,
|
|
||||||
autocorrect: false,
|
|
||||||
autofillHints: const [AutofillHints.newPassword],
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Please enter a new password.';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
TextFormField(
|
|
||||||
controller: _confirmPasswordController,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Confirm new password',
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
),
|
|
||||||
obscureText: true,
|
|
||||||
enableSuggestions: false,
|
|
||||||
autocorrect: false,
|
|
||||||
autofillHints: const [AutofillHints.newPassword],
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Please confirm the new password.';
|
|
||||||
}
|
|
||||||
if (value != _newPasswordController.text) {
|
|
||||||
return 'New passwords do not match.';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
FilledButton.icon(
|
|
||||||
onPressed: _changingPassword ? null : _changePassword,
|
|
||||||
icon: _changingPassword
|
|
||||||
? const SizedBox(
|
|
||||||
width: 18,
|
|
||||||
height: 18,
|
|
||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
|
||||||
)
|
|
||||||
: const Icon(Icons.lock_reset),
|
|
||||||
label: Text(
|
|
||||||
_changingPassword ? 'Updating...' : 'Change password',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Change your password for this account.',
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Form(
|
||||||
|
key: _passwordFormKey,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextFormField(
|
||||||
|
controller: _currentPasswordController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Current password',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
obscureText: true,
|
||||||
|
enableSuggestions: false,
|
||||||
|
autocorrect: false,
|
||||||
|
autofillHints: const [AutofillHints.password],
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Please enter your current password.';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
TextFormField(
|
||||||
|
controller: _newPasswordController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'New password',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
obscureText: true,
|
||||||
|
enableSuggestions: false,
|
||||||
|
autocorrect: false,
|
||||||
|
autofillHints: const [AutofillHints.newPassword],
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Please enter a new password.';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
TextFormField(
|
||||||
|
controller: _confirmPasswordController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Confirm new password',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
obscureText: true,
|
||||||
|
enableSuggestions: false,
|
||||||
|
autocorrect: false,
|
||||||
|
autofillHints: const [AutofillHints.newPassword],
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Please confirm the new password.';
|
||||||
|
}
|
||||||
|
if (value != _newPasswordController.text) {
|
||||||
|
return 'New passwords do not match.';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
FilledButton.icon(
|
||||||
|
onPressed: _changingPassword ? null : _changePassword,
|
||||||
|
icon: _changingPassword
|
||||||
|
? const SizedBox(
|
||||||
|
width: 18,
|
||||||
|
height: 18,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
|
)
|
||||||
|
: const Icon(Icons.lock_reset),
|
||||||
|
label: Text(
|
||||||
|
_changingPassword ? 'Updating...' : 'Change password',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import 'package:flutter/gestures.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:mileograph_flutter/components/pages/calculator.dart';
|
||||||
|
import 'package:mileograph_flutter/components/pages/calculator_details.dart';
|
||||||
import 'package:mileograph_flutter/components/login/login.dart';
|
import 'package:mileograph_flutter/components/login/login.dart';
|
||||||
import 'package:mileograph_flutter/components/pages/dashboard.dart';
|
import 'package:mileograph_flutter/components/pages/dashboard.dart';
|
||||||
import 'package:mileograph_flutter/components/pages/loco_legs.dart';
|
import 'package:mileograph_flutter/components/pages/loco_legs.dart';
|
||||||
@@ -19,10 +21,12 @@ import 'package:mileograph_flutter/services/data_service.dart';
|
|||||||
import 'package:mileograph_flutter/services/navigation_guard.dart';
|
import 'package:mileograph_flutter/services/navigation_guard.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
final GlobalKey<NavigatorState> _shellNavigatorKey = GlobalKey<NavigatorState>();
|
final GlobalKey<NavigatorState> _shellNavigatorKey =
|
||||||
|
GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
const List<String> _contentPages = [
|
const List<String> _contentPages = [
|
||||||
"/dashboard",
|
"/dashboard",
|
||||||
|
"/calculator",
|
||||||
"/logbook",
|
"/logbook",
|
||||||
"/traction",
|
"/traction",
|
||||||
"/add",
|
"/add",
|
||||||
@@ -31,13 +35,14 @@ const List<String> _contentPages = [
|
|||||||
|
|
||||||
const List<String> _defaultTabDestinations = [
|
const List<String> _defaultTabDestinations = [
|
||||||
"/dashboard",
|
"/dashboard",
|
||||||
|
"/calculator",
|
||||||
"/logbook/entries",
|
"/logbook/entries",
|
||||||
"/traction",
|
"/traction",
|
||||||
"/add",
|
"/add",
|
||||||
"/more",
|
"/more",
|
||||||
];
|
];
|
||||||
|
|
||||||
const int _addTabIndex = 3;
|
const int _addTabIndex = 4;
|
||||||
|
|
||||||
class _NavItem {
|
class _NavItem {
|
||||||
final String label;
|
final String label;
|
||||||
@@ -47,6 +52,7 @@ class _NavItem {
|
|||||||
|
|
||||||
const List<_NavItem> _navItems = [
|
const List<_NavItem> _navItems = [
|
||||||
_NavItem("Home", Icons.home),
|
_NavItem("Home", Icons.home),
|
||||||
|
_NavItem("Calculator", Icons.route),
|
||||||
_NavItem("Logbook", Icons.menu_book),
|
_NavItem("Logbook", Icons.menu_book),
|
||||||
_NavItem("Traction", Icons.train),
|
_NavItem("Traction", Icons.train),
|
||||||
_NavItem("Add", Icons.add),
|
_NavItem("Add", Icons.add),
|
||||||
@@ -112,10 +118,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(path: '/', redirect: (context, state) => '/dashboard'),
|
||||||
path: '/',
|
|
||||||
redirect: (context, state) => '/dashboard',
|
|
||||||
),
|
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
navigatorKey: _shellNavigatorKey,
|
navigatorKey: _shellNavigatorKey,
|
||||||
builder: (context, state, child) => MyHomePage(child: child),
|
builder: (context, state, child) => MyHomePage(child: child),
|
||||||
@@ -124,6 +127,17 @@ class _MyAppState extends State<MyApp> {
|
|||||||
path: '/dashboard',
|
path: '/dashboard',
|
||||||
builder: (context, state) => const Dashboard(),
|
builder: (context, state) => const Dashboard(),
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: '/calculator',
|
||||||
|
builder: (context, state) => const CalculatorPage(),
|
||||||
|
routes: [
|
||||||
|
GoRoute(
|
||||||
|
path: 'details',
|
||||||
|
builder: (context, state) =>
|
||||||
|
CalculatorDetailsPage(result: state.extra),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/logbook',
|
path: '/logbook',
|
||||||
redirect: (context, state) => '/logbook/entries',
|
redirect: (context, state) => '/logbook/entries',
|
||||||
@@ -212,7 +226,10 @@ class _MyAppState extends State<MyApp> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
GoRoute(path: '/login', builder: (context, state) => const LoginScreen()),
|
GoRoute(
|
||||||
|
path: '/login',
|
||||||
|
builder: (context, state) => const LoginScreen(),
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/settings',
|
path: '/settings',
|
||||||
builder: (context, state) => const SettingsPage(),
|
builder: (context, state) => const SettingsPage(),
|
||||||
@@ -373,7 +390,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
TextSpan(
|
TextSpan(
|
||||||
children: const [
|
children: const [
|
||||||
TextSpan(text: "Mile"),
|
TextSpan(text: "Mile"),
|
||||||
TextSpan(text: "O", style: TextStyle(color: Colors.red)),
|
TextSpan(
|
||||||
|
text: "O",
|
||||||
|
style: TextStyle(color: Colors.red),
|
||||||
|
),
|
||||||
TextSpan(text: "graph"),
|
TextSpan(text: "graph"),
|
||||||
],
|
],
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -390,7 +410,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
onPressed: () => context.go('/more/settings'),
|
onPressed: () => context.go('/more/settings'),
|
||||||
icon: const Icon(Icons.settings),
|
icon: const Icon(Icons.settings),
|
||||||
),
|
),
|
||||||
IconButton(onPressed: auth.logout, icon: const Icon(Icons.logout)),
|
IconButton(
|
||||||
|
onPressed: auth.logout,
|
||||||
|
icon: const Icon(Icons.logout),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
bottomNavigationBar: isWide
|
bottomNavigationBar: isWide
|
||||||
@@ -448,7 +471,8 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
return Shortcuts(
|
return Shortcuts(
|
||||||
shortcuts: <LogicalKeySet, Intent>{
|
shortcuts: <LogicalKeySet, Intent>{
|
||||||
LogicalKeySet(LogicalKeyboardKey.browserBack): const _BackIntent(),
|
LogicalKeySet(LogicalKeyboardKey.browserBack): const _BackIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.browserForward): const _ForwardIntent(),
|
LogicalKeySet(LogicalKeyboardKey.browserForward):
|
||||||
|
const _ForwardIntent(),
|
||||||
},
|
},
|
||||||
child: Actions(
|
child: Actions(
|
||||||
actions: {
|
actions: {
|
||||||
@@ -474,7 +498,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
canPop: false,
|
canPop: false,
|
||||||
onPopInvokedWithResult: (didPop, _) async {
|
onPopInvokedWithResult: (didPop, _) async {
|
||||||
if (didPop) return;
|
if (didPop) return;
|
||||||
await _handleBackNavigation(allowExit: true, recordForward: false);
|
await _handleBackNavigation(
|
||||||
|
allowExit: true,
|
||||||
|
recordForward: false,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: scaffold,
|
child: scaffold,
|
||||||
),
|
),
|
||||||
@@ -494,7 +521,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRailToggleButton(bool railExtended) {
|
Widget _buildRailToggleButton(bool railExtended) {
|
||||||
final collapseIcon = railExtended ? Icons.chevron_left : Icons.chevron_right;
|
final collapseIcon = railExtended
|
||||||
|
? Icons.chevron_left
|
||||||
|
: Icons.chevron_right;
|
||||||
final collapseLabel = railExtended ? 'Collapse' : 'Expand';
|
final collapseLabel = railExtended ? 'Collapse' : 'Expand';
|
||||||
|
|
||||||
if (railExtended) {
|
if (railExtended) {
|
||||||
@@ -587,8 +616,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
final data = context.watch<DataService>();
|
final data = context.watch<DataService>();
|
||||||
final notifications = data.notifications;
|
final notifications = data.notifications;
|
||||||
final loading = data.isNotificationsLoading;
|
final loading = data.isNotificationsLoading;
|
||||||
final listHeight =
|
final listHeight = isWide
|
||||||
isWide ? 380.0 : MediaQuery.of(context).size.height * 0.6;
|
? 380.0
|
||||||
|
: MediaQuery.of(context).size.height * 0.6;
|
||||||
|
|
||||||
Widget body;
|
Widget body;
|
||||||
if (loading && notifications.isEmpty) {
|
if (loading && notifications.isEmpty) {
|
||||||
@@ -628,9 +658,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
item.title.isNotEmpty
|
item.title.isNotEmpty
|
||||||
? item.title
|
? item.title
|
||||||
: 'Notification',
|
: 'Notification',
|
||||||
style: Theme.of(context)
|
style: Theme.of(context).textTheme.titleMedium
|
||||||
.textTheme
|
|
||||||
.titleMedium
|
|
||||||
?.copyWith(fontWeight: FontWeight.w700),
|
?.copyWith(fontWeight: FontWeight.w700),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
@@ -642,18 +670,15 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
Text(
|
Text(
|
||||||
_formatNotificationTime(item.createdAt!),
|
_formatNotificationTime(item.createdAt!),
|
||||||
style: Theme.of(context)
|
style: Theme.of(context).textTheme.bodySmall
|
||||||
.textTheme
|
|
||||||
.bodySmall
|
|
||||||
?.copyWith(
|
?.copyWith(
|
||||||
color: () {
|
color: () {
|
||||||
final baseColor = Theme.of(context)
|
final baseColor = Theme.of(
|
||||||
.textTheme
|
context,
|
||||||
.bodySmall
|
).textTheme.bodySmall?.color;
|
||||||
?.color;
|
|
||||||
if (baseColor == null) return null;
|
if (baseColor == null) return null;
|
||||||
final newAlpha =
|
final newAlpha = (baseColor.a * 0.7)
|
||||||
(baseColor.a * 0.7).clamp(0.0, 1.0);
|
.clamp(0.0, 1.0);
|
||||||
return baseColor.withValues(
|
return baseColor.withValues(
|
||||||
alpha: newAlpha,
|
alpha: newAlpha,
|
||||||
);
|
);
|
||||||
@@ -666,10 +691,8 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => _dismissNotifications(
|
onPressed: () =>
|
||||||
context,
|
_dismissNotifications(context, [item.id]),
|
||||||
[item.id],
|
|
||||||
),
|
|
||||||
child: const Text('Dismiss'),
|
child: const Text('Dismiss'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -695,19 +718,18 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Notifications',
|
'Notifications',
|
||||||
style: Theme.of(context)
|
style: Theme.of(
|
||||||
.textTheme
|
context,
|
||||||
.titleLarge
|
).textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||||
?.copyWith(fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: notifications.isEmpty
|
onPressed: notifications.isEmpty
|
||||||
? null
|
? null
|
||||||
: () => _dismissNotifications(
|
: () => _dismissNotifications(
|
||||||
context,
|
context,
|
||||||
notifications.map((e) => e.id).toList(),
|
notifications.map((e) => e.id).toList(),
|
||||||
),
|
),
|
||||||
child: const Text('Dismiss all'),
|
child: const Text('Dismiss all'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -729,9 +751,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
try {
|
try {
|
||||||
await context.read<DataService>().dismissNotifications(ids);
|
await context.read<DataService>().dismissNotifications(ids);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
messenger?.showSnackBar(
|
messenger?.showSnackBar(SnackBar(content: Text('Failed to dismiss: $e')));
|
||||||
SnackBar(content: Text('Failed to dismiss: $e')),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -751,9 +771,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
color: Colors.redAccent,
|
color: Colors.redAccent,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(minWidth: 20),
|
||||||
minWidth: 20,
|
|
||||||
),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
label,
|
label,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 0.4.3+1
|
version: 0.4.4+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.8.1
|
sdk: ^3.8.1
|
||||||
|
|||||||
@@ -8,13 +8,12 @@ void main() {
|
|||||||
expect(tabIndexForPath('/calculator/details'), 1);
|
expect(tabIndexForPath('/calculator/details'), 1);
|
||||||
expect(tabIndexForPath('/legs'), 2);
|
expect(tabIndexForPath('/legs'), 2);
|
||||||
expect(tabIndexForPath('/traction/12/timeline'), 3);
|
expect(tabIndexForPath('/traction/12/timeline'), 3);
|
||||||
expect(tabIndexForPath('/trips'), 4);
|
expect(tabIndexForPath('/trips'), 2);
|
||||||
expect(tabIndexForPath('/add'), 5);
|
expect(tabIndexForPath('/add'), 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tabIndexForPath ignores query when parsing uri', () {
|
test('tabIndexForPath ignores query when parsing uri', () {
|
||||||
expect(tabIndexForPath(Uri.parse('/trips?sort=desc').path), 4);
|
expect(tabIndexForPath(Uri.parse('/trips?sort=desc').path), 2);
|
||||||
expect(tabIndexForPath(Uri.parse('/calculator/details?x=1').path), 1);
|
expect(tabIndexForPath(Uri.parse('/calculator/details?x=1').path), 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user