feat: Implement modular routing for the attire capture page with a new route path and navigator method.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:staff_attire/src/presentation/blocs/attire/attire_cubit.dart';
|
||||
import 'package:staff_attire/src/presentation/blocs/attire_capture/attire_capture_cubit.dart';
|
||||
|
||||
@@ -9,6 +10,7 @@ import 'domain/repositories/attire_repository.dart';
|
||||
import 'domain/usecases/get_attire_options_usecase.dart';
|
||||
import 'domain/usecases/save_attire_usecase.dart';
|
||||
import 'domain/usecases/upload_attire_photo_usecase.dart';
|
||||
import 'presentation/pages/attire_capture_page.dart';
|
||||
import 'presentation/pages/attire_page.dart';
|
||||
|
||||
class StaffAttireModule extends Module {
|
||||
@@ -41,5 +43,12 @@ class StaffAttireModule extends Module {
|
||||
StaffPaths.childRoute(StaffPaths.attire, StaffPaths.attire),
|
||||
child: (_) => const AttirePage(),
|
||||
);
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.attire, StaffPaths.attireCapture),
|
||||
child: (_) => AttireCapturePage(
|
||||
item: r.args.data['item'] as AttireItem,
|
||||
initialPhotoUrl: r.args.data['initialPhotoUrl'] as String?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,12 @@ class _AttireCapturePageState extends State<AttireCapturePage> {
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
appBar: UiAppBar(title: widget.item.label, showBackButton: true),
|
||||
appBar: UiAppBar(
|
||||
title: widget.item.label,
|
||||
onLeadingPressed: () {
|
||||
Modular.to.toAttire();
|
||||
},
|
||||
),
|
||||
body: BlocConsumer<AttireCaptureCubit, AttireCaptureState>(
|
||||
bloc: cubit,
|
||||
listener: (BuildContext context, AttireCaptureState state) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:staff_attire/src/presentation/blocs/attire/attire_cubit.dart';
|
||||
import 'package:staff_attire/src/presentation/blocs/attire/attire_state.dart';
|
||||
@@ -10,7 +11,6 @@ import 'package:staff_attire/src/presentation/blocs/attire/attire_state.dart';
|
||||
import '../widgets/attire_filter_chips.dart';
|
||||
import '../widgets/attire_info_card.dart';
|
||||
import '../widgets/attire_item_card.dart';
|
||||
import 'attire_capture_page.dart';
|
||||
|
||||
class AttirePage extends StatefulWidget {
|
||||
const AttirePage({super.key});
|
||||
@@ -112,23 +112,11 @@ class _AttirePageState extends State<AttirePage> {
|
||||
item: item,
|
||||
isUploading: false,
|
||||
uploadedPhotoUrl: state.photoUrls[item.id],
|
||||
onTap: () async {
|
||||
final AttireItem? updatedItem =
|
||||
await Navigator.push<AttireItem?>(
|
||||
context,
|
||||
MaterialPageRoute<AttireItem?>(
|
||||
builder: (BuildContext ctx) =>
|
||||
AttireCapturePage(
|
||||
item: item,
|
||||
initialPhotoUrl:
|
||||
state.photoUrls[item.id],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (updatedItem != null && mounted) {
|
||||
cubit.syncCapturedPhoto(updatedItem);
|
||||
}
|
||||
onTap: () {
|
||||
Modular.to.toAttireCapture(
|
||||
item: item,
|
||||
initialPhotoUrl: state.photoUrls[item.id],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user