feat: Initialize project

This commit is contained in:
Yaël Perret
2024-10-21 22:03:17 +02:00
parent aefa3309d0
commit e722368fa6
404 changed files with 43535 additions and 2 deletions

View File

@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:stacked/stacked.dart';
import 'package:bahla_front/ui/common/ui_helpers.dart';
import 'startup_viewmodel.dart';
class StartupView extends StackedView<StartupViewModel> {
const StartupView({Key? key}) : super(key: key);
@override
Widget builder(
BuildContext context,
StartupViewModel viewModel,
Widget? child,
) {
return const Scaffold(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'STACKED',
style: TextStyle(fontSize: 40, fontWeight: FontWeight.w900),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text('Loading ...', style: TextStyle(fontSize: 16)),
horizontalSpaceSmall,
SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(
color: Colors.black,
strokeWidth: 6,
),
)
],
),
],
),
),
);
}
@override
StartupViewModel viewModelBuilder(
BuildContext context,
) =>
StartupViewModel();
@override
void onViewModelReady(StartupViewModel viewModel) => SchedulerBinding.instance
.addPostFrameCallback((timeStamp) => viewModel.runStartupLogic());
}

View File

@@ -0,0 +1,18 @@
import 'package:stacked/stacked.dart';
import 'package:bahla_front/app/app.locator.dart';
import 'package:bahla_front/app/app.router.dart';
import 'package:stacked_services/stacked_services.dart';
class StartupViewModel extends BaseViewModel {
final _navigationService = locator<NavigationService>();
// Place anything here that needs to happen before we get into the application
Future runStartupLogic() async {
await Future.delayed(const Duration(seconds: 3));
// This is where you can make decisions on where your app should navigate when
// you have custom startup logic
_navigationService.replaceWithHomeView();
}
}