mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +00:00
Update Flutter run and build commands, and added main_staging file
This commit is contained in:
@ -31,7 +31,7 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Build Flutter Web App
|
- name: Build Flutter Web App
|
||||||
run: flutter build web --release --dart-define=FLAVOR=production
|
run: flutter build web --web-renderer canvaskit --flavor production -t lib/main.dart
|
||||||
|
|
||||||
- name: Build And Deploy
|
- name: Build And Deploy
|
||||||
id: builddeploy
|
id: builddeploy
|
||||||
|
@ -31,7 +31,7 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Build Flutter Web App
|
- name: Build Flutter Web App
|
||||||
run: flutter build web --release --dart-define=FLAVOR=development
|
run: flutter build web --web-renderer canvaskit --flavor development -t lib/main_dev.dart
|
||||||
|
|
||||||
- name: Build And Deploy
|
- name: Build And Deploy
|
||||||
id: builddeploy
|
id: builddeploy
|
||||||
|
39
.vscode/launch.json
vendored
39
.vscode/launch.json
vendored
@ -10,11 +10,14 @@
|
|||||||
"type": "dart",
|
"type": "dart",
|
||||||
|
|
||||||
"args": [
|
"args": [
|
||||||
|
"-d",
|
||||||
"--dart-define",
|
"chrome",
|
||||||
|
"--web-port",
|
||||||
"FLAVOR=development"
|
"3000",
|
||||||
|
"--flavor",
|
||||||
|
"development",
|
||||||
|
"-t",
|
||||||
|
"lib/main_dev.dart",
|
||||||
],
|
],
|
||||||
|
|
||||||
"flutterMode": "debug"
|
"flutterMode": "debug"
|
||||||
@ -28,11 +31,14 @@
|
|||||||
"type": "dart",
|
"type": "dart",
|
||||||
|
|
||||||
"args": [
|
"args": [
|
||||||
|
"-d",
|
||||||
"--dart-define",
|
"chrome",
|
||||||
|
"--web-port",
|
||||||
"FLAVOR=staging"
|
"3000",
|
||||||
|
"--flavor",
|
||||||
|
"staging",
|
||||||
|
"-t",
|
||||||
|
"lib/main_staging.dart",
|
||||||
],
|
],
|
||||||
|
|
||||||
"flutterMode": "debug"
|
"flutterMode": "debug"
|
||||||
@ -46,11 +52,14 @@
|
|||||||
"type": "dart",
|
"type": "dart",
|
||||||
|
|
||||||
"args": [
|
"args": [
|
||||||
|
"-d",
|
||||||
"--dart-define",
|
"chrome",
|
||||||
|
"--web-port",
|
||||||
"FLAVOR=production"
|
"3000",
|
||||||
|
"--flavor",
|
||||||
|
"production",
|
||||||
|
"-t",
|
||||||
|
"lib/main_staging.dart",
|
||||||
],
|
],
|
||||||
|
|
||||||
"flutterMode": "debug"
|
"flutterMode": "debug"
|
||||||
|
@ -16,7 +16,12 @@ samples, guidance on mobile development, and a full API reference.
|
|||||||
|
|
||||||
## USEFUL COMMANDS
|
## USEFUL COMMANDS
|
||||||
|
|
||||||
Run on chrome: flutter run -d chrome --dart-define=FLAVOR='ENV_NAME'
|
- Building for the Web
|
||||||
|
- CanvasKit
|
||||||
|
- `flutter build web --web-renderer canvaskit --flavor development -t lib/main_dev.dart --output=build/web_dev` - build for DEVELOPMENT.
|
||||||
|
- `flutter build web --web-renderer canvaskit --flavor staging -t lib/main_staging.dart --output=build/web_stg` - build for STAGING.
|
||||||
|
- `flutter build web --web-renderer canvaskit --flavor production -t lib/main.dart --output=build/web` - build for PRODUCTION.
|
||||||
|
|
||||||
|
- run command: `flutter run -d chrome --flavor development --target=lib/main_dev.dart`
|
||||||
|
|
||||||
Build: flutter build web --release --dart-define=FLAVOR='ENV_NAME'
|
|
||||||
|
|
||||||
|
86
lib/main_staging.dart
Normal file
86
lib/main_staging.dart
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:syncrow_web/firebase_options_dev.dart';
|
||||||
|
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
||||||
|
import 'package:syncrow_web/services/locator.dart';
|
||||||
|
import 'package:syncrow_web/utils/app_routes.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||||
|
import 'package:syncrow_web/utils/theme/theme.dart';
|
||||||
|
|
||||||
|
Future<void> main() async {
|
||||||
|
try {
|
||||||
|
const environment = String.fromEnvironment('FLAVOR', defaultValue: 'staging');
|
||||||
|
await dotenv.load(fileName: '.env.$environment');
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
await Firebase.initializeApp(
|
||||||
|
options: DefaultFirebaseOptionsDev.currentPlatform,
|
||||||
|
);
|
||||||
|
initialSetup();
|
||||||
|
} catch (_) {}
|
||||||
|
runApp(MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
MyApp({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
final GoRouter _router = GoRouter(
|
||||||
|
initialLocation: RoutesConst.auth,
|
||||||
|
routes: AppRoutes.getRoutes(),
|
||||||
|
redirect: (context, state) async {
|
||||||
|
String checkToken = await AuthBloc.getTokenAndValidate();
|
||||||
|
final loggedIn = checkToken == 'Success';
|
||||||
|
final goingToLogin = state.uri.toString() == RoutesConst.auth;
|
||||||
|
|
||||||
|
if (!loggedIn && !goingToLogin) return RoutesConst.auth;
|
||||||
|
if (loggedIn && goingToLogin) return RoutesConst.home;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MultiBlocProvider(
|
||||||
|
providers: [
|
||||||
|
BlocProvider<CreateRoutineBloc>(
|
||||||
|
create: (context) => CreateRoutineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider(create: (context) => HomeBloc()..add(const FetchUserInfo())),
|
||||||
|
BlocProvider<VisitorPasswordBloc>(
|
||||||
|
create: (context) => VisitorPasswordBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider<RoutineBloc>(
|
||||||
|
create: (context) => RoutineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider<SpaceTreeBloc>(
|
||||||
|
create: (context) => SpaceTreeBloc()..add(InitialEvent()),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: MaterialApp.router(
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
||||||
|
dragDevices: {
|
||||||
|
PointerDeviceKind.mouse,
|
||||||
|
PointerDeviceKind.touch,
|
||||||
|
PointerDeviceKind.stylus,
|
||||||
|
PointerDeviceKind.unknown,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
theme: myTheme,
|
||||||
|
routerConfig: _router,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -41,14 +41,12 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<SpaceTreeBloc, SpaceTreeState>(builder: (context, state) {
|
return BlocBuilder<SpaceTreeBloc, SpaceTreeState>(builder: (context, state) {
|
||||||
final communities = state.searchQuery.isNotEmpty
|
final communities =
|
||||||
? state.filteredCommunity
|
state.searchQuery.isNotEmpty ? state.filteredCommunity : state.communityList;
|
||||||
: state.communityList;
|
|
||||||
return Container(
|
return Container(
|
||||||
height: MediaQuery.sizeOf(context).height,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
decoration: widget.isSide == true
|
decoration: widget.isSide == true
|
||||||
? subSectionContainerDecoration.copyWith(
|
? subSectionContainerDecoration.copyWith(color: ColorsManager.whiteColors)
|
||||||
color: ColorsManager.whiteColors)
|
|
||||||
: const BoxDecoration(color: ColorsManager.whiteColors),
|
: const BoxDecoration(color: ColorsManager.whiteColors),
|
||||||
child: state is SpaceTreeLoadingState
|
child: state is SpaceTreeLoadingState
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const Center(child: CircularProgressIndicator())
|
||||||
@ -81,12 +79,10 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
|
|||||||
style: context.textTheme.bodyMedium?.copyWith(
|
style: context.textTheme.bodyMedium?.copyWith(
|
||||||
color: ColorsManager.blackColor,
|
color: ColorsManager.blackColor,
|
||||||
),
|
),
|
||||||
onChanged: (value) =>
|
onChanged: (value) => context.read<SpaceTreeBloc>().add(
|
||||||
context.read<SpaceTreeBloc>().add(
|
SearchQueryEvent(value),
|
||||||
SearchQueryEvent(value),
|
),
|
||||||
),
|
decoration: textBoxDecoration(radios: 20)?.copyWith(
|
||||||
decoration:
|
|
||||||
textBoxDecoration(radios: 20)?.copyWith(
|
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
suffixIcon: Padding(
|
suffixIcon: Padding(
|
||||||
padding: const EdgeInsets.only(right: 16),
|
padding: const EdgeInsets.only(right: 16),
|
||||||
@ -96,8 +92,7 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
|
|||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
hintStyle:
|
hintStyle: context.textTheme.bodyMedium?.copyWith(
|
||||||
context.textTheme.bodyMedium?.copyWith(
|
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: ColorsManager.textGray,
|
color: ColorsManager.textGray,
|
||||||
@ -121,27 +116,30 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
|
|||||||
child: state.isSearching
|
child: state.isSearching
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const Center(child: CircularProgressIndicator())
|
||||||
: SidebarCommunitiesList(
|
: SidebarCommunitiesList(
|
||||||
onScrollToEnd: () => context.read<SpaceTreeBloc>().add(
|
onScrollToEnd: () {
|
||||||
PaginationEvent(
|
if (!state.paginationIsLoading) {
|
||||||
state.paginationModel,
|
context.read<SpaceTreeBloc>().add(
|
||||||
state.communityList,
|
PaginationEvent(
|
||||||
),
|
state.paginationModel,
|
||||||
),
|
state.communityList,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
scrollController: _scrollController,
|
scrollController: _scrollController,
|
||||||
communities: communities,
|
communities: communities,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return CustomExpansionTileSpaceTree(
|
return CustomExpansionTileSpaceTree(
|
||||||
title: communities[index].name,
|
title: communities[index].name,
|
||||||
isSelected: state.selectedCommunities
|
isSelected:
|
||||||
.contains(communities[index].uuid),
|
state.selectedCommunities.contains(communities[index].uuid),
|
||||||
isSoldCheck: state.selectedCommunities
|
isSoldCheck:
|
||||||
.contains(communities[index].uuid),
|
state.selectedCommunities.contains(communities[index].uuid),
|
||||||
onExpansionChanged: () =>
|
onExpansionChanged: () => context.read<SpaceTreeBloc>().add(
|
||||||
context.read<SpaceTreeBloc>().add(
|
OnCommunityExpanded(
|
||||||
OnCommunityExpanded(
|
communities[index].uuid,
|
||||||
communities[index].uuid,
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
isExpanded: state.expandedCommunities.contains(
|
isExpanded: state.expandedCommunities.contains(
|
||||||
communities[index].uuid,
|
communities[index].uuid,
|
||||||
),
|
),
|
||||||
@ -158,8 +156,7 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
|
|||||||
(space) {
|
(space) {
|
||||||
return CustomExpansionTileSpaceTree(
|
return CustomExpansionTileSpaceTree(
|
||||||
title: space.name,
|
title: space.name,
|
||||||
isExpanded:
|
isExpanded: state.expandedSpaces.contains(space.uuid),
|
||||||
state.expandedSpaces.contains(space.uuid),
|
|
||||||
onItemSelected: () {
|
onItemSelected: () {
|
||||||
context.read<SpaceTreeBloc>().add(
|
context.read<SpaceTreeBloc>().add(
|
||||||
OnSpaceSelected(
|
OnSpaceSelected(
|
||||||
@ -170,18 +167,15 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
|
|||||||
);
|
);
|
||||||
widget.onSelect();
|
widget.onSelect();
|
||||||
},
|
},
|
||||||
onExpansionChanged: () =>
|
onExpansionChanged: () => context.read<SpaceTreeBloc>().add(
|
||||||
context.read<SpaceTreeBloc>().add(
|
OnSpaceExpanded(
|
||||||
OnSpaceExpanded(
|
communities[index].uuid,
|
||||||
communities[index].uuid,
|
space.uuid ?? '',
|
||||||
space.uuid ?? '',
|
),
|
||||||
),
|
),
|
||||||
),
|
isSelected: state.selectedSpaces.contains(space.uuid) ||
|
||||||
isSelected: state.selectedSpaces
|
|
||||||
.contains(space.uuid) ||
|
|
||||||
state.soldCheck.contains(space.uuid),
|
|
||||||
isSoldCheck:
|
|
||||||
state.soldCheck.contains(space.uuid),
|
state.soldCheck.contains(space.uuid),
|
||||||
|
isSoldCheck: state.soldCheck.contains(space.uuid),
|
||||||
children: _buildNestedSpaces(
|
children: _buildNestedSpaces(
|
||||||
context,
|
context,
|
||||||
state,
|
state,
|
||||||
@ -210,8 +204,8 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
|
|||||||
) {
|
) {
|
||||||
return space.children.map((child) {
|
return space.children.map((child) {
|
||||||
return CustomExpansionTileSpaceTree(
|
return CustomExpansionTileSpaceTree(
|
||||||
isSelected: state.selectedSpaces.contains(child.uuid) ||
|
isSelected:
|
||||||
state.soldCheck.contains(child.uuid),
|
state.selectedSpaces.contains(child.uuid) || state.soldCheck.contains(child.uuid),
|
||||||
isSoldCheck: state.soldCheck.contains(child.uuid),
|
isSoldCheck: state.soldCheck.contains(child.uuid),
|
||||||
title: child.name,
|
title: child.name,
|
||||||
isExpanded: state.expandedSpaces.contains(child.uuid),
|
isExpanded: state.expandedSpaces.contains(child.uuid),
|
||||||
|
Reference in New Issue
Block a user