Improve web calendar layout and shared sync state

This commit is contained in:
zsolt
2026-08-13 15:25:50 +02:00
parent 5e75c01b3f
commit 332657fc99
9 changed files with 40551 additions and 40265 deletions
+127 -37
View File
@@ -1057,48 +1057,81 @@ class _BarcodeScanDialogState extends State<BarcodeScanDialog> {
content: SizedBox(
width: 520,
height: 360,
child: ClipRRect(
borderRadius: BorderRadius.circular(18),
child: Stack(
fit: StackFit.expand,
children: [
MobileScanner(
controller: controller,
onDetect: (capture) {
if (handled) return;
for (final code in capture.barcodes) {
final value = code.rawValue;
if (value == null || value.trim().isEmpty) continue;
handled = true;
Navigator.pop(context, value);
break;
}
},
),
const Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: EdgeInsets.all(12),
child: DecoratedBox(
decoration: BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.all(Radius.circular(16)),
),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
child: Column(
children: [
if (kIsWeb)
Container(
margin: const EdgeInsets.only(bottom: 10),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: mint,
borderRadius: BorderRadius.circular(16),
),
child: const Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.info_outline, color: sage, size: 20),
SizedBox(width: 8),
Expanded(
child: Text(
'Tartsd a vonalk\u00f3dot az el\u0151lapi kamera el\u00e9.',
style: TextStyle(color: Colors.white),
'Weben a kamera enged\u00e9lyt a b\u00f6ng\u00e9sz\u0151 k\u00e9ri. iPhone/iPad Safari alatt: aA / Webhelybe\u00e1ll\u00edt\u00e1sok / Kamera: Enged\u00e9lyez\u00e9s, majd t\u00f6ltsd \u00fajra az oldalt.',
style: TextStyle(color: ink, fontSize: 12.5),
),
),
),
],
),
),
],
),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.circular(18),
child: Stack(
fit: StackFit.expand,
children: [
MobileScanner(
controller: controller,
placeholderBuilder: (context) =>
const ScannerPermissionHint(),
errorBuilder: (context, error) =>
ScannerPermissionHint(error: error),
onDetectError: (error, stackTrace) {},
onDetect: (capture) {
if (handled) return;
for (final code in capture.barcodes) {
final value = code.rawValue;
if (value == null || value.trim().isEmpty) continue;
handled = true;
Navigator.pop(context, value);
break;
}
},
),
const Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: EdgeInsets.all(12),
child: DecoratedBox(
decoration: BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.all(Radius.circular(16)),
),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
child: Text(
'Tartsd a vonalk\u00f3dot az el\u0151lapi kamera el\u00e9.',
style: TextStyle(color: Colors.white),
),
),
),
),
),
],
),
),
),
],
),
),
actions: [
@@ -1111,6 +1144,63 @@ class _BarcodeScanDialogState extends State<BarcodeScanDialog> {
}
}
class ScannerPermissionHint extends StatelessWidget {
const ScannerPermissionHint({super.key, this.error});
final MobileScannerException? error;
@override
Widget build(BuildContext context) {
return Container(
color: const Color(0xFF172B27),
padding: const EdgeInsets.all(20),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 360),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.photo_camera_outlined,
color: Colors.white,
size: 42,
),
const SizedBox(height: 14),
Text(
error == null
? 'Kamera enged\u00e9ly k\u00e9r\u00e9se...'
: 'A kamera nem el\u00e9rhet\u0151',
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w900,
fontSize: 18,
),
),
const SizedBox(height: 8),
Text(
error == null
? 'Ha a b\u00f6ng\u00e9sz\u0151 r\u00e1k\u00e9rdez, enged\u00e9lyezd a kamer\u00e1t a vonalk\u00f3d beolvas\u00e1s\u00e1hoz.'
: 'Enged\u00e9lyezd a kamer\u00e1t a b\u00f6ng\u00e9sz\u0151 webhelybe\u00e1ll\u00edt\u00e1sain\u00e1l, majd nyisd meg \u00fajra a scannert.',
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white70, height: 1.35),
),
if (error != null) ...[
const SizedBox(height: 10),
Text(
error!.errorCode.name,
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white38, fontSize: 11),
),
],
],
),
),
),
);
}
}
typedef JarvisRegisterCallback =
Future<JarvisSettings> Function(JarvisSettings settings, String deviceName);
typedef JarvisStatusCallback =