import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:smoke_cess_app/services/pages_service.dart'; import 'package:smoke_cess_app/widgets/round_button_widget.dart'; import '../providers/input_provider.dart'; import '../providers/page_provider.dart'; import '../providers/tasks_provider.dart'; import 'popup_for_task_done.dart'; class ViewFormPage extends StatelessWidget { final Widget form; final Widget view; final Pages page; const ViewFormPage( {super.key, required this.form, required this.view, required this.page}); @override Widget build(BuildContext context) { final height = MediaQuery.of(context).size.height; PageProvider pageProvider = context.watch(); TasksProvider tasksProvider = context.watch(); return Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ pageProvider.showForm ? Center( child: ChangeNotifierProvider( create: (context) => InputProvider(), child: form, )) : Center(child: view), if (!pageProvider.showForm) Container( height: height / 8, width: height / 8, margin: EdgeInsets.only(bottom: height * 0.08), child: RoundAddButton( onPressed: tasksProvider.tasks[page] == true ? () => pageProvider.swap() : () => showTaskDonePopup(context, page), ), ) ]); } }