forked from eatvio/eatvio_app
New screen names
This commit is contained in:
24
lib/presentation/splash_screen/bloc/splash_bloc.dart
Normal file
24
lib/presentation/splash_screen/bloc/splash_bloc.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '/core/app_export.dart';
|
||||
import 'package:eatvio_app/presentation/splash_screen/models/splash_model.dart';
|
||||
part 'splash_event.dart';
|
||||
part 'splash_state.dart';
|
||||
|
||||
/// A bloc that manages the state of a Splash according to the event that is dispatched to it.
|
||||
class SplashBloc extends Bloc<SplashEvent, SplashState> {
|
||||
SplashBloc(SplashState initialState) : super(initialState) {
|
||||
on<SplashInitialEvent>(_onInitialize);
|
||||
}
|
||||
|
||||
_onInitialize(
|
||||
SplashInitialEvent event,
|
||||
Emitter<SplashState> emit,
|
||||
) async {
|
||||
Future.delayed(const Duration(milliseconds: 3000), () {
|
||||
NavigatorService.popAndPushNamed(
|
||||
AppRoutes.languageSelectScreen,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
16
lib/presentation/splash_screen/bloc/splash_event.dart
Normal file
16
lib/presentation/splash_screen/bloc/splash_event.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'splash_bloc.dart';
|
||||
|
||||
/// Abstract class for all events that can be dispatched from the
|
||||
///Splash widget.
|
||||
///
|
||||
/// Events must be immutable and implement the [Equatable] interface.
|
||||
@immutable
|
||||
abstract class SplashEvent extends Equatable {}
|
||||
|
||||
/// Event that is dispatched when the Splash widget is first created.
|
||||
class SplashInitialEvent extends SplashEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
20
lib/presentation/splash_screen/bloc/splash_state.dart
Normal file
20
lib/presentation/splash_screen/bloc/splash_state.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'splash_bloc.dart';
|
||||
|
||||
/// Represents the state of Splash in the application.
|
||||
class SplashState extends Equatable {
|
||||
SplashState({this.splashModelObj});
|
||||
|
||||
SplashModel? splashModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
splashModelObj,
|
||||
];
|
||||
SplashState copyWith({SplashModel? splashModelObj}) {
|
||||
return SplashState(
|
||||
splashModelObj: splashModelObj ?? this.splashModelObj,
|
||||
);
|
||||
}
|
||||
}
|
||||
16
lib/presentation/splash_screen/models/splash_model.dart
Normal file
16
lib/presentation/splash_screen/models/splash_model.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// This class defines the variables used in the [splash_screen],
|
||||
/// and is typically used to hold data that is passed between different parts of the application.
|
||||
class SplashModel extends Equatable {
|
||||
SplashModel() {}
|
||||
|
||||
SplashModel copyWith() {
|
||||
return SplashModel();
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
36
lib/presentation/splash_screen/splash_screen.dart
Normal file
36
lib/presentation/splash_screen/splash_screen.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'bloc/splash_bloc.dart';
|
||||
import 'models/splash_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SplashScreen extends StatelessWidget {
|
||||
const SplashScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<SplashBloc>(
|
||||
create: (context) =>
|
||||
SplashBloc(SplashState(splashModelObj: SplashModel()))
|
||||
..add(SplashInitialEvent()),
|
||||
child: SplashScreen());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
mediaQueryData = MediaQuery.of(context);
|
||||
return BlocBuilder<SplashBloc, SplashState>(builder: (context, state) {
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
body: SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 16.v),
|
||||
CustomImageView(
|
||||
imagePath: ImageConstant.img2456927096976,
|
||||
height: 137.adaptSize,
|
||||
width: 137.adaptSize)
|
||||
]))));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user