fix: improve button layout and event log readability

This commit is contained in:
fiatcode 2026-04-30 15:56:16 +07:00
parent 02040081ce
commit c781fc5079
No known key found for this signature in database
2 changed files with 165 additions and 141 deletions

View file

@ -144,16 +144,19 @@ class _MainScreenState extends State<MainScreen> with TickerProviderStateMixin {
children: [
_buildHeader(),
Expanded(
child: Padding(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 16),
_buildStatusCard(),
const SizedBox(height: 16),
_buildTrackingToggle(),
const Spacer(),
_buildActionButtons(),
const SizedBox(height: 12),
_buildSendButton(),
const SizedBox(height: 12),
_buildNavButtons(),
const SizedBox(height: 20),
],
),
@ -367,74 +370,65 @@ class _MainScreenState extends State<MainScreen> with TickerProviderStateMixin {
);
}
Widget _buildActionButtons() {
return Column(
children: [
if (_isTracking)
Padding(
padding: const EdgeInsets.only(bottom: 12),
child: SizedBox(
width: double.infinity,
height: 44,
child: OutlinedButton.icon(
onPressed: () async {
final success = await LocationBridge.reportLocation();
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
success
? 'Location sent to server'
: 'Failed — check logs',
),
backgroundColor: const Color(0xFF1a1a1a),
),
);
}
},
style: OutlinedButton.styleFrom(
foregroundColor: const Color(0xFF00bcd4),
side: const BorderSide(color: Color(0xFF00bcd4), width: 1),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
),
icon: const Icon(Icons.arrow_upward, size: 16),
label: const Text(
'SEND LOCATION',
style: TextStyle(
fontFamily: 'monospace',
letterSpacing: 1,
fontSize: 13,
),
Widget _buildSendButton() {
if (!_isTracking) return const SizedBox.shrink();
return SizedBox(
height: 44,
child: OutlinedButton.icon(
onPressed: () async {
final success = await LocationBridge.reportLocation();
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
success ? 'Location sent to server' : 'Failed — check logs',
),
backgroundColor: const Color(0xFF1a1a1a),
),
);
}
},
style: OutlinedButton.styleFrom(
foregroundColor: const Color(0xFF00bcd4),
side: const BorderSide(color: Color(0xFF00bcd4), width: 1),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
),
icon: const Icon(Icons.arrow_upward, size: 16),
label: const Text(
'SEND LOCATION',
style: TextStyle(
fontFamily: 'monospace',
letterSpacing: 1,
fontSize: 13,
),
),
),
);
}
Widget _buildNavButtons() {
return Row(
children: [
Expanded(
child: _buildNavButton(
icon: Icons.tune,
label: 'SETTINGS',
onTap: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => const SettingsScreen()),
),
),
Row(
children: [
Expanded(
child: _buildNavButton(
icon: Icons.tune,
label: 'SETTINGS',
onTap: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => const SettingsScreen()),
),
),
),
const SizedBox(width: 12),
Expanded(
child: _buildNavButton(
icon: Icons.terminal,
label: 'LOGS',
onTap: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => const StatusScreen()),
),
const SizedBox(width: 12),
Expanded(
child: _buildNavButton(
icon: Icons.terminal,
label: 'LOGS',
onTap: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => const StatusScreen()),
),
),
),
],
),
),
],
);