define.dart 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import 'package:fis_ui/define.dart';
  2. import 'package:flutter/widgets.dart';
  3. import 'package:get/get.dart';
  4. /// for temporary preview only!!!
  5. class QuickFWidget extends StatelessWidget implements FWidget {
  6. const QuickFWidget(this.child, {Key? key}) : super(key: key);
  7. final Widget child;
  8. @override
  9. Widget build(BuildContext context) => child;
  10. }
  11. typedef FWidgetCallback = FWidget Function();
  12. typedef AsyncVoidCallback = Future<void> Function();
  13. class FObx extends Obx implements FWidget {
  14. FObx(FWidgetCallback builder) : super(builder);
  15. }
  16. abstract class FisView<T> extends GetView<T> implements FWidget {
  17. const FisView({Key? key}) : super(key: key);
  18. @override
  19. FWidget build(BuildContext context);
  20. }
  21. class FisBuilder<T extends GetxController> extends GetBuilder<T>
  22. implements FWidget {
  23. const FisBuilder({
  24. Key? key,
  25. T? init,
  26. bool global = true,
  27. required GetControllerBuilder<T> builder,
  28. bool autoRemove = true,
  29. bool assignId = false,
  30. Object Function(T value)? filter,
  31. String? tag,
  32. void Function(GetBuilderState<T> state)? initState,
  33. dispose,
  34. didChangeDependencies,
  35. Object? id,
  36. void Function(GetBuilder oldWidget, GetBuilderState<T> state)?
  37. didUpdateWidget,
  38. }) : super(
  39. key: key,
  40. init: init,
  41. global: global,
  42. builder: builder,
  43. autoRemove: autoRemove,
  44. assignId: assignId,
  45. initState: initState,
  46. filter: filter,
  47. tag: tag,
  48. dispose: dispose,
  49. id: id,
  50. didChangeDependencies: didChangeDependencies,
  51. didUpdateWidget: didUpdateWidget,
  52. );
  53. }