Appbar módosítás, projektnév az alcímben
This commit is contained in:
parent
43af5f5bc8
commit
71305e49f9
@ -10,6 +10,7 @@ import 'package:terepi_seged/services/coord_converter_service.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_device_service.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_service.dart';
|
||||
import 'package:terepi_seged/services/ntrip_service.dart';
|
||||
import 'package:terepi_seged/services/project_service.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
@ -21,6 +22,7 @@ Future<void> main() async {
|
||||
anonKey: dotenv.env['SUPABASE_ANON_KEY']!);
|
||||
|
||||
await AppDatabase.instance.database;
|
||||
Get.put(ProjectService(), permanent: true);
|
||||
|
||||
await Get.putAsync<CoordConverterService>(
|
||||
() => CoordConverterService().init());
|
||||
|
||||
@ -62,7 +62,7 @@ class Project {
|
||||
'crs': crs.name,
|
||||
'color': color,
|
||||
'status': status.name,
|
||||
'isLocalOnly': isLocalOnly,
|
||||
'is_local_only': isLocalOnly,
|
||||
if (lastSyncedAt != null)
|
||||
'last_synced_at': lastSyncedAt!.toIso8601String(),
|
||||
'created_at': createdAt.toIso8601String(),
|
||||
@ -78,9 +78,30 @@ class Project {
|
||||
crs: ProjectCrs.values.byName(m['crs'] as String? ?? 'eov'),
|
||||
color: m['color'] as String? ?? '#185FA5',
|
||||
status: ProjectStatus.values.byName(m['status'] as String? ?? 'active'),
|
||||
isLocalOnly: m['is__local_only'] as bool ?? true,
|
||||
lastSyncedAt: DateTime.parse(m['last_synced_at'] as String),
|
||||
isLocalOnly: _readBool(m, 'is_local_only', defaultValue: false),
|
||||
lastSyncedAt: m['last_synced_at'] == null
|
||||
? null
|
||||
: DateTime.parse(m['last_synced_at'] as String),
|
||||
createdAt: DateTime.parse(m['created_at'] as String),
|
||||
updatedAt: DateTime.parse(m['updated_at'] as String),
|
||||
);
|
||||
}
|
||||
|
||||
bool _readBool(
|
||||
Map<String, dynamic> m,
|
||||
String key, {
|
||||
bool defaultValue = false,
|
||||
}) {
|
||||
final value = m[key];
|
||||
|
||||
if (value == null) return defaultValue;
|
||||
if (value is bool) return value;
|
||||
if (value is int) return value != 0;
|
||||
|
||||
if (value is String) {
|
||||
final lower = value.toLowerCase();
|
||||
return lower == 'true' || lower == '1';
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@ -157,6 +157,8 @@ class AppDatabase {
|
||||
await db.insert('projects', {
|
||||
'uuid': const Uuid().v4(),
|
||||
'name': 'Alapértelmezett projekt',
|
||||
'is_local_only': 0,
|
||||
'status': 'active',
|
||||
'created_at': now,
|
||||
'updated_at': now,
|
||||
});
|
||||
|
||||
@ -94,7 +94,7 @@ class ShellMapAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
// fontFeatures: const [FontFeature.tabularFigures()]))
|
||||
// ])
|
||||
// ]),
|
||||
const GnssIconStatusChip(),
|
||||
// const GnssIconStatusChip(),
|
||||
const SizedBox(width: 2),
|
||||
NtripIconStatusChip(
|
||||
isConnected: NtripService.to.isConnected,
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:terepi_seged/enums/map_survey_mode.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
|
||||
import 'package:terepi_seged/services/project_service.dart';
|
||||
|
||||
class MapModeMenuAnchor extends StatelessWidget {
|
||||
final MapSurveyController controller;
|
||||
@ -13,6 +14,7 @@ class MapModeMenuAnchor extends StatelessWidget {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Obx(() {
|
||||
final p = ProjectService.to.activeProject.value;
|
||||
return MenuAnchor(
|
||||
menuChildren: [
|
||||
MenuItemButton(
|
||||
@ -67,18 +69,19 @@ class MapModeMenuAnchor extends StatelessWidget {
|
||||
vertical: 4,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
Icon(controller.currentModeIcon, size: 14),
|
||||
const SizedBox(width: 1),
|
||||
Icon(controller.currentModeIcon, size: 18),
|
||||
const SizedBox(width: 6),
|
||||
Text(controller.currentModeLabel,
|
||||
style: const TextStyle(
|
||||
fontSize: 14, fontWeight: FontWeight.w600)),
|
||||
const Icon(Icons.arrow_drop_down, size: 18),
|
||||
fontSize: 18, fontWeight: FontWeight.w600)),
|
||||
const Icon(Icons.arrow_drop_down, size: 22),
|
||||
]),
|
||||
Text('Projekt',
|
||||
Text(p == null ? 'Projekt' : p.name,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontSize: 12,
|
||||
fontStyle: FontStyle.italic,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: colorScheme.onSurfaceVariant))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user