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