mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-08 09:43:23 +10:00
Add shared UI components for mesh application
- Introduced `mesh_ui.dart` with reusable widgets including SectionHeader, MeshCard, StatusChip, StatTile, AvatarCircle, SignalBars, RouteChip, PulseDot, BottomSheetHeader, ErrorRetryCard, and ListEntrance. - Implemented `path_map_ui.dart` for path map screens, featuring path distance calculations, playback controls, and a summary list of observed paths. - Created `themed_map_tile_layer.dart` for shared cached map tiles with automatic dark-mode treatment.
This commit is contained in:
@@ -2,12 +2,14 @@ import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import '../l10n/l10n.dart';
|
||||
import '../theme/mesh_theme.dart';
|
||||
|
||||
class QuickSwitchBar extends StatelessWidget {
|
||||
final int selectedIndex;
|
||||
final ValueChanged<int> onDestinationSelected;
|
||||
final int contactsUnreadCount;
|
||||
final int channelsUnreadCount;
|
||||
final bool highContrast;
|
||||
|
||||
const QuickSwitchBar({
|
||||
super.key,
|
||||
@@ -15,6 +17,7 @@ class QuickSwitchBar extends StatelessWidget {
|
||||
required this.onDestinationSelected,
|
||||
this.contactsUnreadCount = 0,
|
||||
this.channelsUnreadCount = 0,
|
||||
this.highContrast = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -22,6 +25,14 @@ class QuickSwitchBar extends StatelessWidget {
|
||||
final theme = Theme.of(context);
|
||||
final colorScheme = theme.colorScheme;
|
||||
final labelStyle = theme.textTheme.labelMedium ?? const TextStyle();
|
||||
final background = highContrast ? MapPalette.panelDark : Colors.transparent;
|
||||
final selectedColor = highContrast
|
||||
? MapPalette.textPrimary
|
||||
: colorScheme.onPrimary;
|
||||
final unselectedColor = highContrast
|
||||
? MapPalette.textSecondary
|
||||
: colorScheme.onSurfaceVariant;
|
||||
final indicator = highContrast ? MapPalette.selected : colorScheme.primary;
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
@@ -31,9 +42,11 @@ class QuickSwitchBar extends StatelessWidget {
|
||||
filter: ImageFilter.blur(sigmaX: 14, sigmaY: 14),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
color: background,
|
||||
border: Border.all(
|
||||
color: colorScheme.outlineVariant.withValues(alpha: 0.4),
|
||||
color: highContrast
|
||||
? MapPalette.border
|
||||
: colorScheme.outlineVariant.withValues(alpha: 0.4),
|
||||
),
|
||||
),
|
||||
child: NavigationBarTheme(
|
||||
@@ -41,22 +54,18 @@ class QuickSwitchBar extends StatelessWidget {
|
||||
backgroundColor: Colors.transparent,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
shadowColor: Colors.transparent,
|
||||
indicatorColor: colorScheme.primaryContainer,
|
||||
indicatorColor: indicator,
|
||||
labelTextStyle: WidgetStateProperty.resolveWith((states) {
|
||||
final isSelected = states.contains(WidgetState.selected);
|
||||
return labelStyle.copyWith(
|
||||
fontWeight: isSelected ? FontWeight.w700 : FontWeight.w500,
|
||||
color: isSelected
|
||||
? colorScheme.onPrimaryContainer
|
||||
: colorScheme.onSurfaceVariant,
|
||||
color: isSelected ? selectedColor : unselectedColor,
|
||||
);
|
||||
}),
|
||||
iconTheme: WidgetStateProperty.resolveWith((states) {
|
||||
final isSelected = states.contains(WidgetState.selected);
|
||||
return IconThemeData(
|
||||
color: isSelected
|
||||
? colorScheme.onPrimaryContainer
|
||||
: colorScheme.onSurfaceVariant,
|
||||
color: isSelected ? selectedColor : unselectedColor,
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user