trcr/lib/main_screen.dart

146 lines
5.1 KiB
Dart
Raw Normal View History

2025-05-05 07:47:09 -07:00
import 'package:flutter/material.dart';
2025-05-05 18:18:36 -07:00
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
2025-05-05 08:02:02 -07:00
import 'status_screen.dart';
import 'settings_screen.dart';
2025-05-05 07:47:09 -07:00
class MainScreen extends StatelessWidget {
const MainScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
2025-05-05 18:18:36 -07:00
title: Text(AppLocalizations.of(context)!.mainTitle),
2025-05-05 07:47:09 -07:00
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
// Tracking Card
Card(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Tracking',
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('Device identifier'),
Row(
children: [
const Text('{id}', style: TextStyle(color: Colors.grey)),
IconButton(
icon: const Icon(Icons.copy),
onPressed: () {},
),
],
),
],
),
SwitchListTile(
contentPadding: EdgeInsets.zero,
title: const Text('Continuous tracking'),
value: true,
onChanged: (bool value) {},
),
Align(
alignment: Alignment.centerRight,
child: ElevatedButton(
onPressed: () {},
child: const Text('Send current location'),
),
),
],
),
),
),
const SizedBox(height: 20),
// Settings Card
Card(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Settings',
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
IconButton(
icon: const Icon(Icons.qr_code_scanner),
onPressed: () {},
),
],
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('Server'),
Row(
children: [
const Text('https://...',
style: TextStyle(color: Colors.grey)),
IconButton(
icon: const Icon(Icons.edit),
onPressed: () {},
),
],
),
],
),
Align(
alignment: Alignment.centerRight,
child: OutlinedButton(
2025-05-05 08:02:02 -07:00
onPressed: () => Navigator.push(
context,
2025-05-07 17:50:16 -07:00
MaterialPageRoute(builder: (_) => const SettingsScreen(editDeviceId: true)),
2025-05-05 08:02:02 -07:00
),
2025-05-05 07:47:09 -07:00
child: const Text('Advanced settings'),
),
),
2025-05-05 07:57:34 -07:00
Align(
alignment: Alignment.centerRight,
child: OutlinedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => const StatusScreen()),
);
},
child: const Text('Show status'),
),
),
2025-05-05 07:47:09 -07:00
],
),
),
),
],
),
),
);
}
}