25 lines
583 B
Dart
25 lines
583 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class AppBuilder extends StatefulWidget {
|
|
const AppBuilder({Key key, this.builder}) : super(key: key);
|
|
final Function(BuildContext) builder;
|
|
|
|
@override
|
|
AppBuilderState createState() => new AppBuilderState();
|
|
|
|
static AppBuilderState of(BuildContext context) {
|
|
return context.ancestorStateOfType(const TypeMatcher<AppBuilderState>());
|
|
}
|
|
}
|
|
|
|
class AppBuilderState extends State<AppBuilder> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return widget.builder(context);
|
|
}
|
|
|
|
void rebuild() {
|
|
setState(() {});
|
|
}
|
|
}
|