Compare commits
14 Commits
v0.1.2
...
842d4b8390
| Author | SHA1 | Date | |
|---|---|---|---|
| 842d4b8390 | |||
| 21ef9c4ab5 | |||
| 9d0cb7668d | |||
| 383de6a33b | |||
| 9e950a1767 | |||
| 20a7c88d2f | |||
| e8057a8cc6 | |||
| a71cc454eb | |||
| f1c1578620 | |||
| 5ef22c7b50 | |||
| 81222de7fe | |||
| 6dc7161b41 | |||
| f1756b30d1 | |||
| 77a524f3ec |
@@ -0,0 +1,39 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AppTheme {
|
||||||
|
AppTheme._();
|
||||||
|
|
||||||
|
static const double formColumnSpacing = 12.0;
|
||||||
|
|
||||||
|
static ThemeData get lightTheme => _baseTheme(
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: Colors.indigo,
|
||||||
|
brightness: Brightness.light,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
static ThemeData get darkTheme => _baseTheme(
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: Colors.indigo,
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
static ThemeData _baseTheme({required ColorScheme colorScheme}) {
|
||||||
|
final theme = ThemeData(useMaterial3: true, colorScheme: colorScheme);
|
||||||
|
final universalBorderRadius = BorderRadius.circular(12);
|
||||||
|
|
||||||
|
return theme.copyWith(
|
||||||
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
|
border: OutlineInputBorder(borderRadius: universalBorderRadius),
|
||||||
|
),
|
||||||
|
|
||||||
|
listTileTheme: ListTileThemeData(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: universalBorderRadius,
|
||||||
|
side: BorderSide(color: colorScheme.secondaryContainer, width: 2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'app_theme.dart';
|
||||||
import 'model/repositories/local_repository.dart';
|
import 'model/repositories/local_repository.dart';
|
||||||
|
import 'pages/locations_overview_page.dart';
|
||||||
import 'pages/task_edit_page.dart';
|
import 'pages/task_edit_page.dart';
|
||||||
import 'pages/task_overview_page.dart';
|
import 'pages/task_overview_page.dart';
|
||||||
import 'service/controller_scope.dart';
|
import 'service/controller_scope.dart';
|
||||||
@@ -33,9 +35,12 @@ class MainApp extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: AppTheme.lightTheme,
|
||||||
|
darkTheme: AppTheme.darkTheme,
|
||||||
routes: {
|
routes: {
|
||||||
TaskOverviewPage.routeName: (context) => TaskOverviewPage(),
|
TaskOverviewPage.routeName: (context) => TaskOverviewPage(),
|
||||||
TaskEditPage.routeName: (context) => TaskEditPage(),
|
TaskEditPage.routeName: (context) => TaskEditPage(),
|
||||||
|
LocationsOverviewPage.routeName: (context) => LocationsOverviewPage(),
|
||||||
},
|
},
|
||||||
initialRoute: TaskOverviewPage.routeName,
|
initialRoute: TaskOverviewPage.routeName,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,6 +5,15 @@ class LatLng {
|
|||||||
LatLng(this.lat, this.lng);
|
LatLng(this.lat, this.lng);
|
||||||
LatLng.empty() : lat = 0, lng = 0;
|
LatLng.empty() : lat = 0, lng = 0;
|
||||||
|
|
||||||
|
/// must be formatted 'double, double'. For example 35.35217, 89.19659
|
||||||
|
factory LatLng.fromString(String latLng) {
|
||||||
|
final splitString = latLng.split(',');
|
||||||
|
final lat = double.parse(splitString[0].trim());
|
||||||
|
final lng = double.parse(splitString[1].trim());
|
||||||
|
|
||||||
|
return LatLng(lat, lng);
|
||||||
|
}
|
||||||
|
|
||||||
factory LatLng.fromJson(Map<String, dynamic> json) {
|
factory LatLng.fromJson(Map<String, dynamic> json) {
|
||||||
return LatLng(json['lat'] as double, json['lng'] as double);
|
return LatLng(json['lat'] as double, json['lng'] as double);
|
||||||
}
|
}
|
||||||
@@ -12,4 +21,18 @@ class LatLng {
|
|||||||
Map<String, double> toJson() {
|
Map<String, double> toJson() {
|
||||||
return {'lat': lat, 'lng': lng};
|
return {'lat': lat, 'lng': lng};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (other is! LatLng) return false;
|
||||||
|
return hashCode == other.hashCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(lat, lng);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '${lat.toString()}, ${lng.toString()}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-2
@@ -1,19 +1,34 @@
|
|||||||
import 'latlng.dart';
|
import 'latlng.dart';
|
||||||
|
|
||||||
class Location {
|
class Location {
|
||||||
|
final String name;
|
||||||
final LatLng coordinates;
|
final LatLng coordinates;
|
||||||
final String address;
|
final String address;
|
||||||
|
|
||||||
Location({required this.coordinates, this.address = ''});
|
Location({required this.name, required this.coordinates, this.address = ''});
|
||||||
|
|
||||||
factory Location.fromJson(Map<String, dynamic> json) {
|
factory Location.fromJson(Map<String, dynamic> json) {
|
||||||
return Location(
|
return Location(
|
||||||
|
name: json['name'] as String,
|
||||||
address: json['address'] as String,
|
address: json['address'] as String,
|
||||||
coordinates: LatLng.fromJson(json['coordinates']),
|
coordinates: LatLng.fromJson(json['coordinates']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {'address': address, 'coordinates': coordinates.toJson()};
|
return {
|
||||||
|
'name': name,
|
||||||
|
'address': address,
|
||||||
|
'coordinates': coordinates.toJson(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (other is! Location) return false;
|
||||||
|
return hashCode == other.hashCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => coordinates.hashCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../model/extensions/controller_context.dart';
|
||||||
|
import '../model/location.dart';
|
||||||
|
import '../service/controllers/location_controller.dart';
|
||||||
|
import '../widgets/dialogs/create_location_dialog.dart';
|
||||||
|
|
||||||
|
class LocationsOverviewPage extends StatefulWidget {
|
||||||
|
static const routeName = '/locations';
|
||||||
|
const LocationsOverviewPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LocationsOverviewPage> createState() => _LocationsOverviewPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LocationsOverviewPageState extends State<LocationsOverviewPage> {
|
||||||
|
List<Location> locations = [];
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
locations = context.controller<LocationController>().locations;
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: Text('Manage Locations')),
|
||||||
|
body: Padding(
|
||||||
|
padding: EdgeInsetsGeometry.symmetric(
|
||||||
|
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
itemBuilder: listViewBuilder,
|
||||||
|
itemCount: context.controller<LocationController>().locations.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: onAddLocationButtonPressed,
|
||||||
|
child: Icon(Icons.add),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget listViewBuilder(BuildContext context, int index) {
|
||||||
|
final location = locations.elementAt(index);
|
||||||
|
final String subtitle = location.address.isEmpty
|
||||||
|
? location.coordinates.toString()
|
||||||
|
: location.address;
|
||||||
|
|
||||||
|
return ListTile(
|
||||||
|
title: Text(location.name),
|
||||||
|
subtitle: Text(subtitle),
|
||||||
|
onTap: () => onEditLocationButtonPressed(location),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onAddLocationButtonPressed() async {
|
||||||
|
final result = await showDialog<Location?>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => CreateLocationDialog(),
|
||||||
|
barrierDismissible: false,
|
||||||
|
);
|
||||||
|
if (mounted && result != null) {
|
||||||
|
context.controller<LocationController>().addLocation(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onEditLocationButtonPressed(Location location) async {
|
||||||
|
final result = await showDialog<Location?>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => CreateLocationDialog(initialLocation: location),
|
||||||
|
barrierDismissible: false,
|
||||||
|
);
|
||||||
|
if (mounted && result != null) {
|
||||||
|
context.controller<LocationController>().updateLocation(location, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../app_theme.dart';
|
||||||
import '../model/callback_models/create_task_request.dart';
|
import '../model/callback_models/create_task_request.dart';
|
||||||
import '../model/extensions/controller_context.dart';
|
import '../model/extensions/controller_context.dart';
|
||||||
import '../model/task.dart';
|
import '../model/task.dart';
|
||||||
@@ -80,7 +81,9 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||||||
horizontal: MediaQuery.of(context).size.width * 0.05,
|
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
spacing: AppTheme.formColumnSpacing,
|
||||||
children: [
|
children: [
|
||||||
|
SizedBox(height: 6),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: titleController,
|
controller: titleController,
|
||||||
@@ -165,7 +168,7 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
).then((result) {
|
).then((result) {
|
||||||
if (result != null && result && context.mounted) {
|
if (result != null && result && mounted) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import '../model/task.dart';
|
|||||||
import '../service/controllers/task_controller.dart';
|
import '../service/controllers/task_controller.dart';
|
||||||
import '../service/tools.dart';
|
import '../service/tools.dart';
|
||||||
import '../widgets/task_dismissible.dart';
|
import '../widgets/task_dismissible.dart';
|
||||||
|
import 'locations_overview_page.dart';
|
||||||
import 'task_edit_page.dart';
|
import 'task_edit_page.dart';
|
||||||
|
|
||||||
class TaskOverviewPage extends StatefulWidget {
|
class TaskOverviewPage extends StatefulWidget {
|
||||||
@@ -22,11 +23,29 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(
|
||||||
body: ReorderableListView.builder(
|
title: Text('Hallo Yannick'),
|
||||||
itemBuilder: itemBuilder,
|
actions: [
|
||||||
itemCount: tasks.length,
|
PopupMenuButton(
|
||||||
onReorderItem: context.controller<TaskController>().reorderTask,
|
itemBuilder: (_) => [
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: onLocationsButtonTapped,
|
||||||
|
child: Text('Locations'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
icon: Icon(Icons.more_vert),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: EdgeInsetsGeometry.symmetric(
|
||||||
|
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||||
|
),
|
||||||
|
child: ReorderableListView.builder(
|
||||||
|
itemBuilder: itemBuilder,
|
||||||
|
itemCount: tasks.length,
|
||||||
|
onReorderItem: context.controller<TaskController>().reorderTask,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: onCreateTaskTapped,
|
onPressed: onCreateTaskTapped,
|
||||||
@@ -38,27 +57,31 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
|||||||
Widget itemBuilder(BuildContext context, int index) {
|
Widget itemBuilder(BuildContext context, int index) {
|
||||||
final task = tasks.elementAt(index);
|
final task = tasks.elementAt(index);
|
||||||
|
|
||||||
return TaskDismissible(
|
return Padding(
|
||||||
key: Key(task.id),
|
key: Key(task.id),
|
||||||
onDismissedRight: () =>
|
padding: const EdgeInsets.only(bottom: 12),
|
||||||
context.controller<TaskController>().deleteTask(task),
|
child: TaskDismissible(
|
||||||
child: ListTile(
|
key: Key(task.id),
|
||||||
title: Text(task.title),
|
onDismissedRight: () =>
|
||||||
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
context.controller<TaskController>().deleteTask(task),
|
||||||
trailing: Checkbox(
|
child: ListTile(
|
||||||
value: task.isCompleted,
|
title: Text(task.title),
|
||||||
onChanged: (isCompleted) => context
|
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
||||||
.controller<TaskController>()
|
trailing: Checkbox(
|
||||||
.saveTask(task.copyWith(isCompleted: isCompleted)),
|
value: task.isCompleted,
|
||||||
|
onChanged: (isCompleted) => context
|
||||||
|
.controller<TaskController>()
|
||||||
|
.saveTask(task.copyWith(isCompleted: isCompleted)),
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
final result = await onTaskTapped(task);
|
||||||
|
if (result != null && context.mounted) {
|
||||||
|
context.controller<TaskController>().saveTask(
|
||||||
|
result.toTask(id: task.id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
onTap: () async {
|
|
||||||
final result = await onTaskTapped(task);
|
|
||||||
if (result != null && context.mounted) {
|
|
||||||
context.controller<TaskController>().saveTask(
|
|
||||||
result.toTask(id: task.id),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -75,10 +98,13 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
|||||||
await Navigator.of(context).pushNamed(TaskEditPage.routeName)
|
await Navigator.of(context).pushNamed(TaskEditPage.routeName)
|
||||||
as CreateTaskRequest?;
|
as CreateTaskRequest?;
|
||||||
|
|
||||||
if (result != null && context.mounted) {
|
if (result != null && mounted) {
|
||||||
context.controller<TaskController>().saveTask(
|
context.controller<TaskController>().saveTask(
|
||||||
result.toTask(id: generateId()),
|
result.toTask(id: generateId()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onLocationsButtonTapped() =>
|
||||||
|
Navigator.of(context).pushNamed(LocationsOverviewPage.routeName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ class LocationController extends ChangeNotifier {
|
|||||||
|
|
||||||
final List<Location> _locations = [];
|
final List<Location> _locations = [];
|
||||||
|
|
||||||
|
List<Location> get locations => _locations;
|
||||||
|
|
||||||
Future<void> addLocation(Location location) {
|
Future<void> addLocation(Location location) {
|
||||||
_locations.add(location);
|
_locations.add(location);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@@ -24,6 +26,16 @@ class LocationController extends ChangeNotifier {
|
|||||||
return _repository.deleteLocation(location);
|
return _repository.deleteLocation(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> updateLocation(Location oldLocation, Location newLocation) {
|
||||||
|
final index = _locations.indexOf(oldLocation);
|
||||||
|
_locations.remove(oldLocation);
|
||||||
|
_locations.insert(index, newLocation);
|
||||||
|
notifyListeners();
|
||||||
|
return _repository
|
||||||
|
.deleteLocation(oldLocation)
|
||||||
|
.whenComplete(() => _repository.createLocation(newLocation));
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _loadLocations() {
|
Future<void> _loadLocations() {
|
||||||
_locations.clear();
|
_locations.clear();
|
||||||
return _repository.loadLocations().then(
|
return _repository.loadLocations().then(
|
||||||
|
|||||||
@@ -12,3 +12,17 @@ String? dateTimeValidator(String? value) {
|
|||||||
|
|
||||||
return DateTime.tryParse(value) != null ? null : 'Not a date format';
|
return DateTime.tryParse(value) != null ? null : 'Not a date format';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String? coordinatesValidator(String? value) {
|
||||||
|
if (value == null || value.isEmpty) return null;
|
||||||
|
|
||||||
|
if (RegExp(r'^\d+\.?\d*, *\d+\.?\d*$').hasMatch(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return 'Not a valid coordinate format';
|
||||||
|
}
|
||||||
|
|
||||||
|
String? notEmptyValidator(String? value) {
|
||||||
|
if (value != null && value.isNotEmpty) return null;
|
||||||
|
return 'Can\'t be empty';
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../app_theme.dart';
|
||||||
|
import '../../model/latlng.dart';
|
||||||
|
import '../../model/location.dart';
|
||||||
|
import '../../service/validators.dart';
|
||||||
|
|
||||||
|
class CreateLocationDialog extends StatefulWidget {
|
||||||
|
const CreateLocationDialog({super.key, this.initialLocation});
|
||||||
|
final Location? initialLocation;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<CreateLocationDialog> createState() => _CreateLocationDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CreateLocationDialogState extends State<CreateLocationDialog> {
|
||||||
|
final nameController = TextEditingController();
|
||||||
|
final addressController = TextEditingController();
|
||||||
|
final coordinatesController = TextEditingController();
|
||||||
|
final formKey = GlobalKey<FormState>(debugLabel: 'Create Location Form');
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
if (widget.initialLocation != null) {
|
||||||
|
nameController.text = widget.initialLocation!.name;
|
||||||
|
addressController.text = widget.initialLocation!.address;
|
||||||
|
coordinatesController.text = widget.initialLocation!.coordinates
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
actions: [
|
||||||
|
TextButton(onPressed: onCancelPressed, child: Text('Cancel')),
|
||||||
|
TextButton(onPressed: onSavePressed, child: Text('Save')),
|
||||||
|
],
|
||||||
|
title: Text('Create Location'),
|
||||||
|
content: Form(
|
||||||
|
key: formKey,
|
||||||
|
child: Column(
|
||||||
|
spacing: AppTheme.formColumnSpacing,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextFormField(
|
||||||
|
autofocus: true,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
controller: nameController,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
decoration: InputDecoration(labelText: 'Name'),
|
||||||
|
validator: notEmptyValidator,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
controller: addressController,
|
||||||
|
keyboardType: TextInputType.streetAddress,
|
||||||
|
decoration: InputDecoration(labelText: 'Address (optional)'),
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
controller: coordinatesController,
|
||||||
|
onFieldSubmitted: (_) => onSavePressed(),
|
||||||
|
keyboardType: TextInputType.numberWithOptions(),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'Coordinates',
|
||||||
|
hint: Text('25.5892, 50.5051662'),
|
||||||
|
),
|
||||||
|
validator: (value) {
|
||||||
|
return notEmptyValidator(value) ?? coordinatesValidator(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onCancelPressed() => Navigator.of(context).pop();
|
||||||
|
|
||||||
|
void onSavePressed() {
|
||||||
|
if (formKey.currentState!.validate()) {
|
||||||
|
Navigator.of(context).pop(
|
||||||
|
Location(
|
||||||
|
name: nameController.text,
|
||||||
|
coordinates: LatLng.fromString(coordinatesController.text),
|
||||||
|
address: addressController.text,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,10 @@ class TaskDismissible extends StatelessWidget {
|
|||||||
key: key!,
|
key: key!,
|
||||||
direction: DismissDirection.startToEnd,
|
direction: DismissDirection.startToEnd,
|
||||||
background: Container(
|
background: Container(
|
||||||
color: Theme.of(context).colorScheme.error,
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Theme.of(context).colorScheme.error,
|
||||||
|
),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: AlignmentGeometry.centerLeft,
|
alignment: AlignmentGeometry.centerLeft,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|||||||
Reference in New Issue
Block a user