// The free-form mark: stamped into the open recording from anywhere, beside the // checklist's structured ones. import 'dart:math'; import 'package:flutter/material.dart'; import '../link/boundary.dart'; const quickMarks = [ 'cold start', 'engine start', 'indicator left', 'indicator right', 'brake', 'headlights', 'something odd', ]; Future showMarkSheet(BuildContext context, Boundary b) { final custom = TextEditingController(); return showModalBottomSheet( context: context, isScrollControlled: true, useSafeArea: true, builder: (ctx) { void send(String text) { if (text.trim().isEmpty) return; b.command('mark', {'text': text.trim()}); Navigator.pop(ctx); } return Padding( // Clear the keyboard when it is up, the navigation bar when it is not. padding: EdgeInsets.fromLTRB( 16, 16, 16, 16 + max( MediaQuery.of(ctx).viewInsets.bottom, MediaQuery.of(ctx).viewPadding.bottom, ), ), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Text( 'Stamp into the recording', style: Theme.of(ctx).textTheme.titleMedium, ), const SizedBox(height: 8), Wrap( spacing: 8, runSpacing: 8, children: [ for (final q in quickMarks) ActionChip(label: Text(q), onPressed: () => send(q)), ], ), TextField( controller: custom, decoration: const InputDecoration(labelText: 'Other'), onSubmitted: send, ), ], ), ); }, ); }