outing_log_create_page.dart 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_riverpod/flutter_riverpod.dart';
  3. import 'package:go_router/go_router.dart';
  4. import 'package:tdesign_flutter/tdesign_flutter.dart';
  5. import '../../shared/widgets/nav_bar_config.dart';
  6. import '../../shared/widgets/form_section.dart';
  7. import '../../shared/widgets/form_field_row.dart';
  8. import '../../shared/widgets/action_bar.dart';
  9. import '../../core/i18n/app_localizations.dart';
  10. import '../../core/theme/app_colors_extension.dart';
  11. import '../../core/theme/app_colors.dart';
  12. class OutingLogCreatePage extends ConsumerStatefulWidget {
  13. const OutingLogCreatePage({super.key});
  14. @override
  15. ConsumerState<OutingLogCreatePage> createState() =>
  16. _OutingLogCreatePageState();
  17. }
  18. class _OutingLogCreatePageState extends ConsumerState<OutingLogCreatePage> {
  19. final _customerCtrl = TextEditingController();
  20. final _summaryCtrl = TextEditingController();
  21. final _planCtrl = TextEditingController();
  22. final _summaryFocus = FocusNode();
  23. final _scrollCtrl = ScrollController();
  24. // GPS 模拟
  25. String _gpsAddress = '深圳市南山区科技园南路88号';
  26. final double _gpsLat = 22.5431;
  27. final double _gpsLng = 113.9532;
  28. double _gpsAccuracy = 15.0;
  29. bool _gpsFailed = false;
  30. // 客户联想
  31. final List<String> _mockCustomers = [
  32. '华软科技',
  33. '云创数据',
  34. '数据引力',
  35. '天诚科技',
  36. '博思软件',
  37. '智云科技',
  38. '恒通信息',
  39. '创新无限',
  40. ];
  41. String? _selectedCustomer;
  42. // 客户联系人
  43. final Map<String, List<Map<String, String>>> _mockContacts = {
  44. '华软科技': [
  45. {'name': '赵经理', 'phone': '13800138001', 'position': 'IT经理'},
  46. {'name': '李主管', 'phone': '13800138002', 'position': '采购主管'},
  47. ],
  48. '云创数据': [
  49. {'name': '陈经理', 'phone': '13800138003', 'position': '技术总监'},
  50. ],
  51. '数据引力': [
  52. {'name': '孙总', 'phone': '13800138004', 'position': '总经理'},
  53. ],
  54. '天诚科技': [
  55. {'name': '周主任', 'phone': '13800138005', 'position': '办公室主任'},
  56. ],
  57. };
  58. Map<String, String>? _selectedContact;
  59. // 照片
  60. final List<String> _photos = [];
  61. static const int _maxPhotos = 9;
  62. @override
  63. void initState() {
  64. super.initState();
  65. _summaryFocus.addListener(() => _ensureVisible(_summaryFocus));
  66. }
  67. void _ensureVisible(FocusNode node) {
  68. if (!node.hasFocus) return;
  69. WidgetsBinding.instance.addPostFrameCallback((_) {
  70. if (node.hasFocus && _scrollCtrl.hasClients) {
  71. final ctx = node.context;
  72. if (ctx != null) {
  73. Scrollable.ensureVisible(
  74. ctx,
  75. alignment: 0.3,
  76. duration: const Duration(milliseconds: 300),
  77. );
  78. }
  79. }
  80. });
  81. }
  82. @override
  83. void dispose() {
  84. _customerCtrl.dispose();
  85. _summaryCtrl.dispose();
  86. _planCtrl.dispose();
  87. _summaryFocus.dispose();
  88. _scrollCtrl.dispose();
  89. super.dispose();
  90. }
  91. bool _hasUnsaved() =>
  92. _customerCtrl.text.isNotEmpty ||
  93. _summaryCtrl.text.isNotEmpty ||
  94. _planCtrl.text.isNotEmpty ||
  95. _photos.isNotEmpty;
  96. void _unfocus() => FocusScope.of(context).unfocus();
  97. void _showConfirmDialog(
  98. String title,
  99. String content,
  100. String leftText,
  101. String rightText,
  102. VoidCallback onConfirm,
  103. ) {
  104. _unfocus();
  105. final colors = Theme.of(context).extension<AppColorsExtension>()!;
  106. showDialog(
  107. context: context,
  108. builder: (ctx) => TDAlertDialog(
  109. title: title,
  110. content: content,
  111. buttonStyle: TDDialogButtonStyle.text,
  112. leftBtn: TDDialogButtonOptions(
  113. title: leftText,
  114. titleColor: colors.primary,
  115. action: () => Navigator.pop(ctx),
  116. ),
  117. rightBtn: TDDialogButtonOptions(
  118. title: rightText,
  119. titleColor: colors.danger,
  120. action: () {
  121. Navigator.pop(ctx);
  122. onConfirm();
  123. },
  124. ),
  125. ),
  126. );
  127. }
  128. Future<void> _pickCustomer() async {
  129. final l10n = AppLocalizations.of(context);
  130. final searchCtrl = TextEditingController();
  131. final selected = await showDialog<String>(
  132. context: context,
  133. builder: (ctx) {
  134. String filter = '';
  135. return StatefulBuilder(
  136. builder: (context, setDialogState) {
  137. final query = filter;
  138. final suggestions = query.isEmpty
  139. ? _mockCustomers
  140. : _mockCustomers.where((c) => c.contains(query)).toList();
  141. return AlertDialog(
  142. title: Text(l10n.get('searchCustomer')),
  143. content: SizedBox(
  144. width: double.maxFinite,
  145. child: Column(
  146. mainAxisSize: MainAxisSize.min,
  147. children: [
  148. TDInput(
  149. controller: searchCtrl,
  150. hintText: l10n.get('searchCustomer'),
  151. onChanged: (v) {
  152. filter = v;
  153. setDialogState(() {});
  154. },
  155. ),
  156. const SizedBox(height: 8),
  157. if (suggestions.isEmpty)
  158. Padding(
  159. padding: const EdgeInsets.all(16),
  160. child: Text(
  161. l10n.get('noData'),
  162. style: TextStyle(
  163. fontSize: AppFontSizes.body,
  164. color: Theme.of(context)
  165. .extension<AppColorsExtension>()!
  166. .textPlaceholder,
  167. ),
  168. ),
  169. )
  170. else
  171. SizedBox(
  172. height: 300,
  173. child: ListView.separated(
  174. shrinkWrap: true,
  175. itemCount: suggestions.length,
  176. separatorBuilder: (_, _) => const Divider(height: 1),
  177. itemBuilder: (_, i) => ListTile(
  178. dense: true,
  179. title: Text(suggestions[i]),
  180. onTap: () => Navigator.pop(ctx, suggestions[i]),
  181. ),
  182. ),
  183. ),
  184. ],
  185. ),
  186. ),
  187. actions: [
  188. TextButton(
  189. onPressed: () => Navigator.pop(ctx),
  190. child: Text(l10n.get('cancel')),
  191. ),
  192. ],
  193. );
  194. },
  195. );
  196. },
  197. );
  198. searchCtrl.dispose();
  199. if (selected != null && mounted) {
  200. setState(() {
  201. _selectedCustomer = selected;
  202. _customerCtrl.text = selected;
  203. _selectedContact = null;
  204. });
  205. }
  206. }
  207. Future<void> _pickContact() async {
  208. final l10n = AppLocalizations.of(context);
  209. if (_selectedCustomer == null) {
  210. TDToast.showText(l10n.get('selectCustomerFirst'), context: context);
  211. return;
  212. }
  213. final contacts = _mockContacts[_selectedCustomer];
  214. if (contacts == null || contacts.isEmpty) {
  215. TDToast.showText(l10n.get('noContact'), context: context);
  216. return;
  217. }
  218. final result = await showDialog<Map<String, String>>(
  219. context: context,
  220. builder: (ctx) => TDAlertDialog.vertical(
  221. title: l10n.get('selectContact'),
  222. buttons: contacts
  223. .map(
  224. (c) => TDDialogButtonOptions(
  225. title: '${c['name']} ${c['position']} ${c['phone']}',
  226. action: () => Navigator.pop(ctx, c),
  227. ),
  228. )
  229. .toList(),
  230. ),
  231. );
  232. if (result != null && mounted) {
  233. setState(() => _selectedContact = result);
  234. }
  235. }
  236. Future<void> _takePhoto() async {
  237. final l10n = AppLocalizations.of(context);
  238. if (_photos.length >= _maxPhotos) {
  239. TDToast.showText(l10n.get('maxPhotoCount'), context: context);
  240. return;
  241. }
  242. final idx = _photos.length + 1;
  243. setState(() {
  244. _photos.add('photo_placeholder_$idx');
  245. });
  246. if (context.mounted) {
  247. TDToast.showText(
  248. l10n.getString(
  249. 'mockPhotoTaken',
  250. args: {
  251. 'idx': '$idx',
  252. 'time': DateTime.now().toString().substring(0, 19),
  253. 'lat': '$_gpsLat°N',
  254. 'lng': '$_gpsLng°E',
  255. },
  256. ),
  257. context: context,
  258. );
  259. }
  260. }
  261. void _removePhoto(int index) {
  262. setState(() => _photos.removeAt(index));
  263. }
  264. Future<void> _simulateGps() async {
  265. final l10n = AppLocalizations.of(context);
  266. setState(() {
  267. _gpsFailed = false;
  268. _gpsAddress = '深圳市南山区科技园南路88号';
  269. _gpsAccuracy = 15.0;
  270. });
  271. TDToast.showText(l10n.get('gpsSuccess'), context: context);
  272. }
  273. Future<void> _saveDraft() async {
  274. final l10n = AppLocalizations.of(context);
  275. if (context.mounted) {
  276. TDToast.showText(l10n.get('draftSavedToast'), context: context);
  277. }
  278. }
  279. Future<void> _submit() async {
  280. final l10n = AppLocalizations.of(context);
  281. if (_gpsFailed) {
  282. TDToast.showText(l10n.get('gpsPermission'), context: context);
  283. return;
  284. }
  285. if (_gpsAddress.isEmpty) {
  286. TDToast.showText(l10n.get('gpsLocatingWait'), context: context);
  287. return;
  288. }
  289. if (_photos.isEmpty) {
  290. TDToast.showText(l10n.get('requiredPhotos'), context: context);
  291. return;
  292. }
  293. if (_summaryCtrl.text.trim().isEmpty) {
  294. TDToast.showText(l10n.get('requiredSummary'), context: context);
  295. return;
  296. }
  297. if (context.mounted) {
  298. TDToast.showText(l10n.get('outingLogSubmitted'), context: context);
  299. context.pop();
  300. }
  301. }
  302. // ─────────────────────────────────────────────
  303. // Build
  304. // ─────────────────────────────────────────────
  305. @override
  306. Widget build(BuildContext context) {
  307. final colors = Theme.of(context).extension<AppColorsExtension>()!;
  308. final l10n = AppLocalizations.of(context);
  309. ref
  310. .read(navBarConfigProvider.notifier)
  311. .update(
  312. NavBarConfig(
  313. title: l10n.get('outingLogCreate'),
  314. showBack: true,
  315. onBack: () {
  316. if (_hasUnsaved()) {
  317. _showConfirmDialog(
  318. l10n.get('confirmExit'),
  319. l10n.get('unsavedContentWarning'),
  320. l10n.get('continueEditing'),
  321. l10n.get('discardAndExit'),
  322. () => context.pop(),
  323. );
  324. } else {
  325. context.pop();
  326. }
  327. },
  328. ),
  329. );
  330. return PopScope(
  331. canPop: false,
  332. onPopInvokedWithResult: (didPop, _) {
  333. if (!didPop) {
  334. if (_hasUnsaved()) {
  335. _showConfirmDialog(
  336. l10n.get('confirmExit'),
  337. l10n.get('unsavedContentWarning'),
  338. l10n.get('continueEditing'),
  339. l10n.get('discardAndExit'),
  340. () => context.pop(),
  341. );
  342. } else {
  343. context.pop();
  344. }
  345. }
  346. },
  347. child: Column(
  348. children: [
  349. Expanded(
  350. child: GestureDetector(
  351. onTap: () => FocusScope.of(context).unfocus(),
  352. child: SingleChildScrollView(
  353. controller: _scrollCtrl,
  354. padding: const EdgeInsets.all(16),
  355. child: Column(
  356. children: [
  357. _buildGpsSection(),
  358. const SizedBox(height: 16),
  359. _buildCustomerSection(l10n, colors),
  360. const SizedBox(height: 16),
  361. _buildSummarySection(l10n, colors),
  362. const SizedBox(height: 16),
  363. _buildPlanSection(l10n, colors),
  364. const SizedBox(height: 16),
  365. _buildPhotosSection(l10n, colors),
  366. const SizedBox(height: 80),
  367. ],
  368. ),
  369. ),
  370. ),
  371. ),
  372. ActionBar(
  373. centerLabel: l10n.get('saveDraft'),
  374. rightLabel: l10n.get('submit'),
  375. showLeft: false,
  376. onCenterTap: _saveDraft,
  377. onRightTap: _submit,
  378. ),
  379. ],
  380. ),
  381. );
  382. }
  383. // ═══ GPS 定位 ═══
  384. Widget _buildGpsSection() {
  385. final l10n = AppLocalizations.of(context);
  386. final colors = Theme.of(context).extension<AppColorsExtension>()!;
  387. return FormSection(
  388. title: 'GPS定位',
  389. leadingIcon: Icons.location_on_outlined,
  390. children: [
  391. if (_gpsFailed)
  392. Row(
  393. children: [
  394. Icon(Icons.location_off, size: 22, color: colors.statusGray),
  395. const SizedBox(width: 10),
  396. Expanded(
  397. child: Column(
  398. crossAxisAlignment: CrossAxisAlignment.start,
  399. children: [
  400. Text(
  401. l10n.get('gpsFailed'),
  402. style: TextStyle(
  403. fontSize: AppFontSizes.body,
  404. color: colors.textPrimary,
  405. ),
  406. ),
  407. const SizedBox(height: 4),
  408. Text(
  409. l10n.get('gpsFailedHint'),
  410. style: TextStyle(
  411. fontSize: AppFontSizes.caption,
  412. color: colors.textSecondary,
  413. ),
  414. ),
  415. ],
  416. ),
  417. ),
  418. GestureDetector(
  419. onTap: _simulateGps,
  420. child: Container(
  421. padding: const EdgeInsets.symmetric(
  422. horizontal: 12,
  423. vertical: 6,
  424. ),
  425. decoration: BoxDecoration(
  426. color: colors.primaryLight,
  427. borderRadius: BorderRadius.circular(4),
  428. ),
  429. child: Text(
  430. l10n.get('retry'),
  431. style: TextStyle(
  432. fontSize: AppFontSizes.caption,
  433. color: colors.primary,
  434. ),
  435. ),
  436. ),
  437. ),
  438. ],
  439. )
  440. else
  441. _buildGpsSuccess(colors),
  442. ],
  443. );
  444. }
  445. Widget _buildGpsSuccess(AppColorsExtension colors) {
  446. final isWarning = _gpsAccuracy > 100;
  447. return Row(
  448. crossAxisAlignment: CrossAxisAlignment.start,
  449. children: [
  450. Icon(
  451. Icons.shield_outlined,
  452. size: 22,
  453. color: isWarning ? colors.warning : colors.success,
  454. ),
  455. const SizedBox(width: 10),
  456. Expanded(
  457. child: Column(
  458. crossAxisAlignment: CrossAxisAlignment.start,
  459. children: [
  460. Text(
  461. _gpsAddress,
  462. style: TextStyle(
  463. fontSize: AppFontSizes.body,
  464. color: colors.textPrimary,
  465. ),
  466. ),
  467. const SizedBox(height: 4),
  468. Row(
  469. children: [
  470. Text(
  471. '${_gpsLat.toStringAsFixed(4)}°N, ${_gpsLng.toStringAsFixed(4)}°E · 精度 ${_gpsAccuracy.toStringAsFixed(0)}m',
  472. style: TextStyle(
  473. fontSize: AppFontSizes.caption,
  474. color: isWarning ? colors.warning : colors.textSecondary,
  475. ),
  476. ),
  477. if (isWarning) ...[
  478. const SizedBox(width: 6),
  479. Icon(
  480. Icons.warning_amber_rounded,
  481. size: 14,
  482. color: colors.warning,
  483. ),
  484. ],
  485. ],
  486. ),
  487. ],
  488. ),
  489. ),
  490. ],
  491. );
  492. }
  493. // ═══ 客户信息 ═══
  494. Widget _buildCustomerSection(AppLocalizations l10n, AppColorsExtension colors) {
  495. return FormSection(
  496. title: l10n.get('customerInfo'),
  497. leadingIcon: Icons.business_outlined,
  498. children: [
  499. FormFieldRow(
  500. label: l10n.get('customerName'),
  501. value: _selectedCustomer,
  502. hint: l10n.get('searchCustomer'),
  503. onTap: _pickCustomer,
  504. ),
  505. const SizedBox(height: 16),
  506. FormFieldRow(
  507. label: l10n.get('selectContact'),
  508. value: _selectedContact != null
  509. ? '${_selectedContact!['name']} ${_selectedContact!['phone']}'
  510. : null,
  511. hint: l10n.get('selectContactHint'),
  512. onTap: _pickContact,
  513. ),
  514. ],
  515. );
  516. }
  517. // ═══ 工作总结 ═══
  518. Widget _buildSummarySection(AppLocalizations l10n, AppColorsExtension colors) {
  519. return FormSection(
  520. title: l10n.get('workSummary'),
  521. leadingIcon: Icons.description_outlined,
  522. children: [
  523. _label(l10n.get('workSummary'), required: true),
  524. const SizedBox(height: 8),
  525. TDTextarea(
  526. controller: _summaryCtrl,
  527. focusNode: _summaryFocus,
  528. hintText: l10n.get('workSummaryRequiredHint'),
  529. maxLines: 5,
  530. minLines: 1,
  531. maxLength: 500,
  532. indicator: true,
  533. padding: EdgeInsets.zero,
  534. bordered: true,
  535. backgroundColor: colors.bgPage,
  536. ),
  537. ],
  538. );
  539. }
  540. // ═══ 跟进计划 ═══
  541. Widget _buildPlanSection(AppLocalizations l10n, AppColorsExtension colors) {
  542. return FormSection(
  543. title: l10n.get('followUp'),
  544. leadingIcon: Icons.event_note_outlined,
  545. children: [
  546. _label(l10n.get('followUp')),
  547. const SizedBox(height: 8),
  548. TDInput(
  549. controller: _planCtrl,
  550. hintText: l10n.get('followUpOptional'),
  551. decoration: BoxDecoration(
  552. color: colors.bgPage,
  553. borderRadius: BorderRadius.circular(4),
  554. border: Border.all(color: colors.border),
  555. ),
  556. ),
  557. ],
  558. );
  559. }
  560. // ═══ 现场拍照 ═══
  561. Widget _buildPhotosSection(AppLocalizations l10n, AppColorsExtension colors) {
  562. return FormSection(
  563. title: l10n.get('sitePhotos'),
  564. leadingIcon: Icons.camera_alt_outlined,
  565. showAction: _photos.length < _maxPhotos,
  566. actionText: _photos.length >= _maxPhotos
  567. ? l10n.get('limitReached')
  568. : l10n.get('takePhoto'),
  569. onActionTap: _photos.length >= _maxPhotos ? null : _takePhoto,
  570. children: [
  571. if (_photos.isEmpty)
  572. GestureDetector(
  573. onTap: _takePhoto,
  574. child: Container(
  575. height: 100,
  576. decoration: BoxDecoration(
  577. color: colors.bgPage,
  578. borderRadius: BorderRadius.circular(4),
  579. border: Border.all(color: colors.border, width: 1),
  580. ),
  581. child: Center(
  582. child: Column(
  583. mainAxisAlignment: MainAxisAlignment.center,
  584. children: [
  585. Icon(
  586. Icons.camera_alt_outlined,
  587. size: 32,
  588. color: colors.primary,
  589. ),
  590. const SizedBox(height: 4),
  591. Text(
  592. l10n.get('tapToTakePhoto'),
  593. style: TextStyle(
  594. fontSize: AppFontSizes.caption,
  595. color: colors.textPlaceholder,
  596. ),
  597. ),
  598. ],
  599. ),
  600. ),
  601. ),
  602. )
  603. else
  604. Wrap(
  605. spacing: 8,
  606. runSpacing: 8,
  607. children: [
  608. ..._photos.asMap().entries.map(
  609. (entry) => _buildPhotoThumbnail(entry.key, entry.value),
  610. ),
  611. if (_photos.length < _maxPhotos)
  612. GestureDetector(
  613. onTap: _takePhoto,
  614. child: Container(
  615. width: 80,
  616. height: 80,
  617. decoration: BoxDecoration(
  618. color: colors.bgPage,
  619. borderRadius: BorderRadius.circular(4),
  620. border: Border.all(color: colors.border),
  621. ),
  622. child: Icon(
  623. Icons.add,
  624. size: 28,
  625. color: colors.primary,
  626. ),
  627. ),
  628. ),
  629. ],
  630. ),
  631. const SizedBox(height: 8),
  632. Container(
  633. padding: const EdgeInsets.all(8),
  634. decoration: BoxDecoration(
  635. color: colors.primaryLight,
  636. borderRadius: BorderRadius.circular(4),
  637. ),
  638. child: Row(
  639. children: [
  640. Icon(
  641. Icons.info_outline,
  642. size: 14,
  643. color: colors.primary,
  644. ),
  645. const SizedBox(width: 6),
  646. Expanded(
  647. child: Text(
  648. l10n.getString(
  649. 'watermarkHintDynamic',
  650. args: {
  651. 'lat': _gpsLat.toStringAsFixed(4),
  652. 'lng': _gpsLng.toStringAsFixed(4),
  653. },
  654. ),
  655. style: TextStyle(
  656. fontSize: AppFontSizes.caption,
  657. color: colors.textSecondary,
  658. ),
  659. ),
  660. ),
  661. ],
  662. ),
  663. ),
  664. ],
  665. );
  666. }
  667. Widget _buildPhotoThumbnail(int index, String photo) {
  668. final colors = Theme.of(context).extension<AppColorsExtension>()!;
  669. return Stack(
  670. children: [
  671. Container(
  672. width: 80,
  673. height: 80,
  674. decoration: BoxDecoration(
  675. color: colors.infoBorder,
  676. borderRadius: BorderRadius.circular(4),
  677. ),
  678. child: Center(
  679. child: Icon(Icons.image_outlined, size: 32, color: colors.primary),
  680. ),
  681. ),
  682. Positioned(
  683. top: -4,
  684. right: -4,
  685. child: GestureDetector(
  686. onTap: () => _removePhoto(index),
  687. child: Container(
  688. padding: const EdgeInsets.all(2),
  689. decoration: BoxDecoration(
  690. color: colors.danger,
  691. shape: BoxShape.circle,
  692. ),
  693. child: const Icon(Icons.close, size: 14, color: Colors.white),
  694. ),
  695. ),
  696. ),
  697. Positioned(
  698. bottom: 2,
  699. left: 2,
  700. right: 2,
  701. child: Container(
  702. padding: const EdgeInsets.symmetric(horizontal: 2),
  703. color: Colors.black54,
  704. child: Text(
  705. '${DateTime.now().hour.toString().padLeft(2, '0')}:${DateTime.now().minute.toString().padLeft(2, '0')} ${_gpsLat.toStringAsFixed(2)},${_gpsLng.toStringAsFixed(2)}',
  706. style: const TextStyle(fontSize: 8, color: Colors.white),
  707. maxLines: 1,
  708. overflow: TextOverflow.ellipsis,
  709. ),
  710. ),
  711. ),
  712. ],
  713. );
  714. }
  715. Widget _label(String t, {bool required = false}) {
  716. final colors = Theme.of(context).extension<AppColorsExtension>()!;
  717. return Text.rich(
  718. TextSpan(
  719. children: [
  720. TextSpan(
  721. text: t,
  722. style: TextStyle(
  723. fontSize: AppFontSizes.subtitle,
  724. color: colors.textSecondary,
  725. ),
  726. ),
  727. if (required)
  728. TextSpan(
  729. text: ' *',
  730. style: TextStyle(
  731. fontSize: AppFontSizes.subtitle,
  732. color: colors.danger,
  733. ),
  734. ),
  735. ],
  736. ),
  737. );
  738. }
  739. }