2022-11-01 08:23:35 +01:00
|
|
|
// SPDX-FileCopyrightText: 2022 Iconica
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
2022-09-20 11:04:00 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'form_page_controller.dart';
|
|
|
|
|
|
|
|
class FormState extends InheritedWidget {
|
|
|
|
const FormState({
|
|
|
|
Key? key,
|
|
|
|
required Widget child,
|
|
|
|
required this.formController,
|
|
|
|
}) : super(key: key, child: child);
|
|
|
|
|
2022-09-28 12:02:40 +02:00
|
|
|
final FlutterFormPageController formController;
|
2022-09-20 11:04:00 +02:00
|
|
|
|
|
|
|
static FormState of(BuildContext context) {
|
|
|
|
final FormState? result =
|
|
|
|
context.dependOnInheritedWidgetOfExactType<FormState>();
|
|
|
|
assert(result != null, 'No FormStat found in context');
|
|
|
|
return result!;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool updateShouldNotify(FormState oldWidget) =>
|
|
|
|
formController != oldWidget.formController;
|
|
|
|
}
|