feat(ui_layout): update example & move configure function (#69)
This commit was merged in pull request #70.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
|
||||
class CustomAppBar extends AppBarComponent {
|
||||
const CustomAppBar({super.title, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => AppBar(
|
||||
title: Text(super.title ?? ''),
|
||||
);
|
||||
|
||||
@override
|
||||
AppBarComponent configure({String? title}) => CustomAppBar(
|
||||
title: title ?? this.title,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
|
||||
class CustomBottomNavigationBar extends BottomNavigationBarComponent {
|
||||
const CustomBottomNavigationBar({
|
||||
super.currentIndex,
|
||||
super.onTap,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => BottomNavigationBar(
|
||||
currentIndex: currentIndex,
|
||||
onTap: (index) => super.onTap?.call(context, index),
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
label: 'Icon 1',
|
||||
icon: Icon(
|
||||
Icons.nearby_off,
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: 'Icon 2',
|
||||
icon: Icon(
|
||||
Icons.dangerous,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@override
|
||||
CustomBottomNavigationBar configure({
|
||||
void Function(BuildContext, int)? onTap,
|
||||
int currentIndex = 0,
|
||||
}) =>
|
||||
CustomBottomNavigationBar(
|
||||
onTap: onTap ?? this.onTap,
|
||||
currentIndex: currentIndex,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
|
||||
class CustomErrorWidget extends ErrorWidgetComponent {
|
||||
const CustomErrorWidget({super.error, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ColoredBox(
|
||||
color: Colors.red,
|
||||
child: Center(child: Text(error ?? 'Error')),
|
||||
);
|
||||
|
||||
@override
|
||||
ErrorWidgetComponent configure({String? error}) =>
|
||||
CustomErrorWidget(error: error ?? this.error);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
|
||||
class CustomLoadingWidget extends LoadingWidgetComponent {
|
||||
const CustomLoadingWidget({super.color, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: color,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
CustomLoadingWidget configure({Color? color}) => CustomLoadingWidget(
|
||||
color: color ?? this.color,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user