feat(ui_layout): add loading & error widget to component theme (close #69)
This commit is contained in:
parent
3558697f80
commit
3980181611
@ -0,0 +1,5 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
abstract class Component extends StatelessWidget {
|
||||||
|
const Component({super.key});
|
||||||
|
}
|
@ -15,19 +15,16 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:wyatt_ui_components/src/domain/entities/component.dart';
|
||||||
|
|
||||||
abstract class AppBarComponent extends PreferredSize {
|
abstract class AppBarComponent extends Component {
|
||||||
final String? title;
|
final String? title;
|
||||||
const AppBarComponent({this.title, super.key})
|
const AppBarComponent({this.title, super.key});
|
||||||
: super(
|
|
||||||
preferredSize: const Size.fromHeight(60),
|
|
||||||
child: const SizedBox.shrink(),
|
|
||||||
);
|
|
||||||
|
|
||||||
AppBarComponent configure({String? title});
|
AppBarComponent configure({String? title});
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class BottomNavigationBarComponent extends StatelessWidget {
|
abstract class BottomNavigationBarComponent extends Component {
|
||||||
final int currentIndex;
|
final int currentIndex;
|
||||||
final void Function(BuildContext, int)? onTap;
|
final void Function(BuildContext, int)? onTap;
|
||||||
const BottomNavigationBarComponent({
|
const BottomNavigationBarComponent({
|
||||||
@ -41,3 +38,12 @@ abstract class BottomNavigationBarComponent extends StatelessWidget {
|
|||||||
int currentIndex = 0,
|
int currentIndex = 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class ErrorWidget extends Component {
|
||||||
|
final String error;
|
||||||
|
const ErrorWidget({required this.error, super.key});
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class LoadingWidget extends Component {
|
||||||
|
const LoadingWidget({super.key});
|
||||||
|
}
|
||||||
|
@ -19,9 +19,13 @@ import 'package:wyatt_ui_components/src/domain/entities/components.dart';
|
|||||||
class ComponentThemeData {
|
class ComponentThemeData {
|
||||||
final AppBarComponent appBar;
|
final AppBarComponent appBar;
|
||||||
final BottomNavigationBarComponent bottomNavigationBar;
|
final BottomNavigationBarComponent bottomNavigationBar;
|
||||||
|
final ErrorWidget errorWidget;
|
||||||
|
final LoadingWidget loadingWidget;
|
||||||
|
|
||||||
const ComponentThemeData.raw({
|
const ComponentThemeData.raw({
|
||||||
required this.appBar,
|
required this.appBar,
|
||||||
required this.bottomNavigationBar,
|
required this.bottomNavigationBar,
|
||||||
|
required this.errorWidget,
|
||||||
|
required this.loadingWidget,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user