add initial project files for Flutter app with platform-specific configs and basic routing setup
This commit is contained in:
127
lib/pages/map/widgets/toolbar.dart
Normal file
127
lib/pages/map/widgets/toolbar.dart
Normal file
@@ -0,0 +1,127 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart' as shadcn;
|
||||
|
||||
const List<BoxShadow> _hudShadow = [
|
||||
BoxShadow(
|
||||
color: Color(0x26000000),
|
||||
blurRadius: 4,
|
||||
spreadRadius: 2,
|
||||
),
|
||||
];
|
||||
|
||||
class MapToolbar extends StatelessWidget {
|
||||
const MapToolbar({
|
||||
required this.isAddPointArmed,
|
||||
required this.pointCount,
|
||||
required this.onAddPointPressed,
|
||||
required this.onUndoPressed,
|
||||
required this.onClearPressed,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final bool isAddPointArmed;
|
||||
final int pointCount;
|
||||
final VoidCallback onAddPointPressed;
|
||||
final VoidCallback onUndoPressed;
|
||||
final VoidCallback onClearPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
shadcn.OutlinedContainer(
|
||||
boxShadow: _hudShadow,
|
||||
child: SizedBox(
|
||||
width: 56,
|
||||
height: 56,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const [
|
||||
shadcn.Icon(shadcn.LucideIcons.menu, size: 16),
|
||||
SizedBox(height: 2),
|
||||
Text('Menu', style: TextStyle(fontSize: 10)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
shadcn.OutlinedContainer(
|
||||
boxShadow: _hudShadow,
|
||||
child: Column(
|
||||
children: [
|
||||
_ToolButton(
|
||||
icon: shadcn.LucideIcons.plus,
|
||||
label: 'Add',
|
||||
selected: isAddPointArmed,
|
||||
onTap: onAddPointPressed,
|
||||
),
|
||||
_ToolButton(
|
||||
icon: shadcn.LucideIcons.undo2,
|
||||
label: 'Undo',
|
||||
onTap: onUndoPressed,
|
||||
),
|
||||
_ToolButton(
|
||||
icon: shadcn.LucideIcons.trash2,
|
||||
label: 'Clear',
|
||||
onTap: onClearPressed,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
shadcn.OutlinedContainer(
|
||||
boxShadow: _hudShadow,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||
child: Text('$pointCount pts', style: const TextStyle(fontSize: 11)),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ToolButton extends StatelessWidget {
|
||||
const _ToolButton({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
this.selected = false,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
final bool selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bg = selected ? const Color(0xFFFF4D79) : Colors.transparent;
|
||||
final fg = selected ? Colors.white : const Color(0xFF111827);
|
||||
|
||||
return Material(
|
||||
color: bg,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: SizedBox(
|
||||
width: 56,
|
||||
height: 56,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
shadcn.Icon(icon, size: 16, color: fg),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: fg,
|
||||
fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user