Support multiple tracked people with colored markers and watch menu
- Replace single tracking with list of TrackedPerson objects in ShareProvider - Each tracked person gets a unique color from a predefined palette - Add watch menu (bottom sheet) with list of tracked people, coordinates, and remove buttons - Add ability to add new tracked people by Share ID - Render multiple colored markers on the map - Start/stop periodic polling for all tracked people
This commit is contained in:
@@ -1,6 +1,23 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../services/share_service.dart';
|
import '../services/share_service.dart';
|
||||||
|
|
||||||
|
class TrackedPerson {
|
||||||
|
final String shareId;
|
||||||
|
final String name;
|
||||||
|
final Color color;
|
||||||
|
Map<String, dynamic>? position;
|
||||||
|
Timer? timer;
|
||||||
|
|
||||||
|
TrackedPerson({
|
||||||
|
required this.shareId,
|
||||||
|
required this.color,
|
||||||
|
this.name = '',
|
||||||
|
this.position,
|
||||||
|
this.timer,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
class ShareProvider with ChangeNotifier {
|
class ShareProvider with ChangeNotifier {
|
||||||
final ShareService _shareService;
|
final ShareService _shareService;
|
||||||
|
|
||||||
@@ -11,9 +28,18 @@ class ShareProvider with ChangeNotifier {
|
|||||||
|
|
||||||
Map<String, dynamic>? _position;
|
Map<String, dynamic>? _position;
|
||||||
|
|
||||||
String _trackingShareId = '';
|
final List<TrackedPerson> _trackedPeople = [];
|
||||||
String _trackingToken = '';
|
final List<Color> _markerColors = [
|
||||||
Map<String, dynamic>? _trackedPosition;
|
Colors.red,
|
||||||
|
Colors.green,
|
||||||
|
Colors.orange,
|
||||||
|
Colors.purple,
|
||||||
|
Colors.teal,
|
||||||
|
Colors.pink,
|
||||||
|
Colors.brown,
|
||||||
|
Colors.indigo,
|
||||||
|
];
|
||||||
|
int _nextColorIndex = 0;
|
||||||
|
|
||||||
ShareProvider({ShareService? shareService})
|
ShareProvider({ShareService? shareService})
|
||||||
: _shareService = shareService ?? ShareService();
|
: _shareService = shareService ?? ShareService();
|
||||||
@@ -24,8 +50,7 @@ class ShareProvider with ChangeNotifier {
|
|||||||
String get error => _error;
|
String get error => _error;
|
||||||
Map<String, dynamic>? get position => _position;
|
Map<String, dynamic>? get position => _position;
|
||||||
|
|
||||||
String get trackingShareId => _trackingShareId;
|
List<TrackedPerson> get trackedPeople => List.unmodifiable(_trackedPeople);
|
||||||
Map<String, dynamic>? get trackedPosition => _trackedPosition;
|
|
||||||
|
|
||||||
Future<void> createShare(String token, double x, double y) async {
|
Future<void> createShare(String token, double x, double y) async {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
@@ -72,20 +97,29 @@ class ShareProvider with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> startTracking(String shareId, String token) async {
|
Future<void> addTracking(String shareId, String token) async {
|
||||||
_trackingShareId = shareId;
|
if (_trackedPeople.any((p) => p.shareId == shareId)) return;
|
||||||
_trackingToken = token;
|
|
||||||
_error = '';
|
final color = _markerColors[_nextColorIndex % _markerColors.length];
|
||||||
|
_nextColorIndex++;
|
||||||
|
|
||||||
|
final person = TrackedPerson(
|
||||||
|
shareId: shareId,
|
||||||
|
color: color,
|
||||||
|
name: 'Person ${_trackedPeople.length + 1}',
|
||||||
|
);
|
||||||
|
_trackedPeople.add(person);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
await updateTrackedPosition();
|
await _updatePersonPosition(token, person);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateTrackedPosition() async {
|
Future<void> _updatePersonPosition(String token, TrackedPerson person) async {
|
||||||
if (_trackingShareId.isEmpty) return;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_trackedPosition = await _shareService.getPositionByShareId(_trackingToken, _trackingShareId);
|
person.position = await _shareService.getPositionByShareId(
|
||||||
|
token,
|
||||||
|
person.shareId,
|
||||||
|
);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_error = e.toString();
|
_error = e.toString();
|
||||||
@@ -93,10 +127,30 @@ class ShareProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopTracking() {
|
void startTrackingPolling(String token) {
|
||||||
_trackingShareId = '';
|
for (final person in _trackedPeople) {
|
||||||
_trackingToken = '';
|
person.timer = Timer.periodic(
|
||||||
_trackedPosition = null;
|
const Duration(seconds: 5),
|
||||||
|
(_) => _updatePersonPosition(token, person),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeTracking(String shareId) {
|
||||||
|
final index = _trackedPeople.indexWhere((p) => p.shareId == shareId);
|
||||||
|
if (index != -1) {
|
||||||
|
_trackedPeople[index].timer?.cancel();
|
||||||
|
_trackedPeople.removeAt(index);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void stopAllTracking() {
|
||||||
|
for (final person in _trackedPeople) {
|
||||||
|
person.timer?.cancel();
|
||||||
|
}
|
||||||
|
_trackedPeople.clear();
|
||||||
|
_nextColorIndex = 0;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+224
-113
@@ -20,7 +20,6 @@ class MapScreen extends StatefulWidget {
|
|||||||
class _MapScreenState extends State<MapScreen> {
|
class _MapScreenState extends State<MapScreen> {
|
||||||
LatLng _center = const LatLng(40.7128, -74.0060);
|
LatLng _center = const LatLng(40.7128, -74.0060);
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
Timer? _trackingTimer;
|
|
||||||
Timer? _geoTimer;
|
Timer? _geoTimer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -31,7 +30,6 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_trackingTimer?.cancel();
|
|
||||||
_geoTimer?.cancel();
|
_geoTimer?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
@@ -73,9 +71,9 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(
|
||||||
SnackBar(content: Text('Ошибка геолокации: $e')),
|
context,
|
||||||
);
|
).showSnackBar(SnackBar(content: Text('Ошибка геолокации: $e')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,78 +116,79 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(
|
||||||
SnackBar(content: Text('Ошибка обновления позиции: $e')),
|
context,
|
||||||
);
|
).showSnackBar(SnackBar(content: Text('Ошибка обновления позиции: $e')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _copyShareLink() {
|
void _copyShareLink() {
|
||||||
final shareProvider = context.read<ShareProvider>();
|
final shareProvider = context.read<ShareProvider>();
|
||||||
if (shareProvider.shareId.isNotEmpty) {
|
if (shareProvider.shareId.isNotEmpty) {
|
||||||
Clipboard.setData(ClipboardData(text: 'watch/${shareProvider.shareId}'));
|
Clipboard.setData(ClipboardData(text: shareProvider.shareId));
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(
|
||||||
const SnackBar(content: Text('Ссылка скопирована')),
|
context,
|
||||||
);
|
).showSnackBar(const SnackBar(content: Text('Ссылка скопирована')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _startTracking() {
|
void _openWatchMenu() {
|
||||||
final authProvider = context.read<AuthProvider>();
|
final authProvider = context.read<AuthProvider>();
|
||||||
final shareProvider = context.read<ShareProvider>();
|
final shareProvider = context.read<ShareProvider>();
|
||||||
|
|
||||||
if (shareProvider.trackingShareId.isEmpty) {
|
showModalBottomSheet(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
isScrollControlled: true,
|
||||||
final TextEditingController _controller = TextEditingController();
|
builder: (context) => _WatchMenu(
|
||||||
return AlertDialog(
|
token: authProvider.token,
|
||||||
title: const Text('Отслеживание'),
|
onAdd: (shareId) async {
|
||||||
content: SingleChildScrollView(
|
await shareProvider.addTracking(shareId, authProvider.token);
|
||||||
child: Column(
|
if (shareProvider.trackedPeople.length == 1) {
|
||||||
mainAxisSize: MainAxisSize.min,
|
shareProvider.startTrackingPolling(authProvider.token);
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
|
||||||
const Text('Введите Share ID для отслеживания:'),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
TextField(
|
|
||||||
controller: _controller,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
hintText: 'Введите Share ID',
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.pop(context),
|
|
||||||
child: const Text('Отмена'),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
final shareId = _controller.text.trim();
|
|
||||||
if (shareId.isNotEmpty) {
|
|
||||||
Navigator.pop(context);
|
|
||||||
final token = authProvider.token;
|
|
||||||
await shareProvider.startTracking(shareId, token);
|
|
||||||
_trackingTimer = Timer.periodic(
|
|
||||||
const Duration(seconds: 5),
|
|
||||||
(_) => shareProvider.updateTrackedPosition(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text('Начать'),
|
onRemove: (shareId) {
|
||||||
),
|
shareProvider.removeTracking(shareId);
|
||||||
],
|
if (shareProvider.trackedPeople.isEmpty) {
|
||||||
);
|
shareProvider.stopAllTracking();
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
shareProvider.stopTracking();
|
|
||||||
_trackingTimer?.cancel();
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Marker> _buildMarkers(ShareProvider shareProvider) {
|
||||||
|
final markers = <Marker>[
|
||||||
|
Marker(
|
||||||
|
point: _center,
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
child: const Icon(Icons.my_location, color: Colors.blue, size: 30),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
for (final person in shareProvider.trackedPeople) {
|
||||||
|
if (person.position != null) {
|
||||||
|
final pos = person.position!;
|
||||||
|
final lat = pos['y'] is String
|
||||||
|
? double.parse(pos['y'])
|
||||||
|
: pos['y'] as double;
|
||||||
|
final lng = pos['x'] is String
|
||||||
|
? double.parse(pos['x'])
|
||||||
|
: pos['x'] as double;
|
||||||
|
|
||||||
|
markers.add(
|
||||||
|
Marker(
|
||||||
|
point: LatLng(lat, lng),
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
child: Icon(Icons.person, color: person.color, size: 30),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return markers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -199,26 +198,7 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
final shareProvider = context.watch<ShareProvider>();
|
final shareProvider = context.watch<ShareProvider>();
|
||||||
|
|
||||||
if (_loading) {
|
if (_loading) {
|
||||||
return Scaffold(
|
return Scaffold(body: const Center(child: CircularProgressIndicator()));
|
||||||
body: const Center(child: CircularProgressIndicator()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Marker? trackedMarker;
|
|
||||||
if (shareProvider.trackedPosition != null) {
|
|
||||||
final pos = shareProvider.trackedPosition!;
|
|
||||||
final lat = pos['y'] is String ? double.parse(pos['y']) : pos['y'] as double;
|
|
||||||
final lng = pos['x'] is String ? double.parse(pos['x']) : pos['x'] as double;
|
|
||||||
trackedMarker = Marker(
|
|
||||||
point: LatLng(lat, lng),
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
child: const Icon(
|
|
||||||
Icons.person,
|
|
||||||
color: Colors.red,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -232,20 +212,10 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
icon: const Icon(Icons.refresh),
|
icon: const Icon(Icons.refresh),
|
||||||
onPressed: _updateGeolocation,
|
onPressed: _updateGeolocation,
|
||||||
),
|
),
|
||||||
|
IconButton(icon: const Icon(Icons.share), onPressed: _copyShareLink),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.share),
|
icon: const Icon(Icons.visibility),
|
||||||
onPressed: _copyShareLink,
|
onPressed: _openWatchMenu,
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
shareProvider.trackingShareId.isEmpty
|
|
||||||
? Icons.person_search
|
|
||||||
: Icons.person,
|
|
||||||
color: shareProvider.trackingShareId.isEmpty
|
|
||||||
? null
|
|
||||||
: Colors.red,
|
|
||||||
),
|
|
||||||
onPressed: _startTracking,
|
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.logout),
|
icon: const Icon(Icons.logout),
|
||||||
@@ -258,33 +228,174 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: FlutterMap(
|
body: FlutterMap(
|
||||||
options: MapOptions(
|
options: MapOptions(initialCenter: _center, initialZoom: 12.0),
|
||||||
initialCenter: _center,
|
|
||||||
initialZoom: 12.0,
|
|
||||||
),
|
|
||||||
children: [
|
children: [
|
||||||
TileLayer(
|
TileLayer(
|
||||||
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||||
maxZoom: 20,
|
maxZoom: 20,
|
||||||
userAgentPackageName: 'FamilySafety/1.0.0',
|
userAgentPackageName: 'FamilySafety/1.0.0',
|
||||||
),
|
),
|
||||||
MarkerLayer(
|
MarkerLayer(markers: _buildMarkers(shareProvider)),
|
||||||
markers: [
|
|
||||||
Marker(
|
|
||||||
point: _center,
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
child: const Icon(
|
|
||||||
Icons.my_location,
|
|
||||||
color: Colors.blue,
|
|
||||||
size: 30,)
|
|
||||||
|
|
||||||
),
|
|
||||||
if (trackedMarker != null) trackedMarker,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _WatchMenu extends StatefulWidget {
|
||||||
|
final String token;
|
||||||
|
final Future<void> Function(String shareId) onAdd;
|
||||||
|
final void Function(String shareId) onRemove;
|
||||||
|
|
||||||
|
const _WatchMenu({
|
||||||
|
required this.token,
|
||||||
|
required this.onAdd,
|
||||||
|
required this.onRemove,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_WatchMenu> createState() => _WatchMenuState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _WatchMenuState extends State<_WatchMenu> {
|
||||||
|
final TextEditingController _controller = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final shareProvider = context.watch<ShareProvider>();
|
||||||
|
final trackedPeople = shareProvider.trackedPeople;
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: MediaQuery.of(context).viewInsets.bottom,
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(maxHeight: 400),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||||
|
borderRadius: const BorderRadius.vertical(
|
||||||
|
top: Radius.circular(16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.visibility, size: 24),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
const Text(
|
||||||
|
'Отслеживаемые',
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
if (trackedPeople.isNotEmpty)
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
shareProvider.stopAllTracking();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: const Text('Очистить'),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (trackedPeople.isEmpty)
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.all(32),
|
||||||
|
child: Text(
|
||||||
|
'Нет отслеживаемых людей',
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (trackedPeople.isNotEmpty)
|
||||||
|
Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: trackedPeople.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final person = trackedPeople[index];
|
||||||
|
final hasPosition = person.position != null;
|
||||||
|
return ListTile(
|
||||||
|
leading: CircleAvatar(
|
||||||
|
backgroundColor: person.color,
|
||||||
|
child: const Icon(
|
||||||
|
Icons.person,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Text(person.name),
|
||||||
|
subtitle: hasPosition
|
||||||
|
? Text(
|
||||||
|
'${person.position!['y'].toStringAsFixed(4)}, ${person.position!['x'].toStringAsFixed(4)}',
|
||||||
|
)
|
||||||
|
: const Text('Нет данных'),
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: const Icon(Icons.close, color: Colors.red),
|
||||||
|
onPressed: () => widget.onRemove(person.shareId),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||||
|
borderRadius: const BorderRadius.vertical(
|
||||||
|
bottom: Radius.circular(16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller: _controller,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
hintText: 'Введите Share ID',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onSubmitted: (value) {
|
||||||
|
if (value.trim().isNotEmpty) {
|
||||||
|
widget.onAdd(value.trim());
|
||||||
|
_controller.clear();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (_controller.text.trim().isNotEmpty) {
|
||||||
|
widget.onAdd(_controller.text.trim());
|
||||||
|
_controller.clear();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('Добавить'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user