feat: condivisione piano pasti via QR code
Porta la funzionalità QR code dalla versione Vue a Flutter.
Condividi: pulsante in fondo alla tab Pasti (attivo solo con piano
non vuoto) → bottom sheet con QR code generato da qr_flutter.
Payload: { "v": 1, "meals": { ... } }, limite 2953 byte.
Ricevi: pulsante sempre visibile → QrScanPage full-screen con
fotocamera via mobile_scanner, cornice di mira, validazione
struttura JSON e importazione via MealPlannerProvider.importPlan().
Nuovi package: qr_flutter ^4.1.0, mobile_scanner ^5.0.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../providers/meal_planner_provider.dart';
|
||||
import '../widgets/meal_card.dart';
|
||||
import '../widgets/qr_share_sheet.dart';
|
||||
import '../pages/qr_scan_page.dart';
|
||||
import '../../../shopping_list/providers/shopping_list_provider.dart';
|
||||
import '../../../../core/constants/app_constants.dart';
|
||||
|
||||
@@ -136,6 +138,32 @@ class MealPlannerPage extends StatelessWidget {
|
||||
child: const Text('Svuota piano'),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: provider.plan.hasAnyMeal
|
||||
? () => showQrShareSheet(context, provider.plan)
|
||||
: null,
|
||||
icon: const Icon(Icons.qr_code, size: 18),
|
||||
label: const Text('Condividi'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const QrScanPage()),
|
||||
),
|
||||
icon: const Icon(Icons.qr_code_scanner, size: 18),
|
||||
label: const Text('Ricevi'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user