58 lines
1.9 KiB
Dart
58 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Help bottom sheet: one icon + sentence per control, close button at the end.
|
|
/// Shared by Knjiga, camera and stream so their info buttons look the same.
|
|
void showHelpSheet(
|
|
BuildContext context, {
|
|
required List<(IconData, String)> items,
|
|
required Color accent,
|
|
required String Function(String) t,
|
|
}) {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
builder: (sheet) => SafeArea(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.fromLTRB(24, 8, 24, 16),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(t('Help'),
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.bold)),
|
|
const SizedBox(height: 16),
|
|
for (final (icon, text) in items)
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 14),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Icon(icon, color: accent, size: 20),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Text(t(text),
|
|
style: const TextStyle(
|
|
color: Colors.white, fontSize: 14, height: 1.3)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
SizedBox(
|
|
width: double.infinity,
|
|
child: FilledButton(
|
|
style: FilledButton.styleFrom(backgroundColor: accent),
|
|
onPressed: () => Navigator.pop(sheet),
|
|
child: Text(t('Close')),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|