feat(ui_layout): add loading & error widget to component theme (close #69)
This commit is contained in:
parent
6d3c64d17c
commit
098ec9715e
@ -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/>.
|
||||
|
||||
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;
|
||||
const AppBarComponent({this.title, super.key})
|
||||
: super(
|
||||
preferredSize: const Size.fromHeight(60),
|
||||
child: const SizedBox.shrink(),
|
||||
);
|
||||
const AppBarComponent({this.title, super.key});
|
||||
|
||||
AppBarComponent configure({String? title});
|
||||
}
|
||||
|
||||
abstract class BottomNavigationBarComponent extends StatelessWidget {
|
||||
abstract class BottomNavigationBarComponent extends Component {
|
||||
final int currentIndex;
|
||||
final void Function(BuildContext, int)? onTap;
|
||||
const BottomNavigationBarComponent({
|
||||
@ -41,3 +38,12 @@ abstract class BottomNavigationBarComponent extends StatelessWidget {
|
||||
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 {
|
||||
final AppBarComponent appBar;
|
||||
final BottomNavigationBarComponent bottomNavigationBar;
|
||||
final ErrorWidget errorWidget;
|
||||
final LoadingWidget loadingWidget;
|
||||
|
||||
const ComponentThemeData.raw({
|
||||
required this.appBar,
|
||||
required this.bottomNavigationBar,
|
||||
required this.errorWidget,
|
||||
required this.loadingWidget,
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user