feat: legacy mobile apps created
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:krow/core/entity/staff_contact_entity.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
part 'assigned_staff_event.dart';
|
||||
part 'assigned_staff_state.dart';
|
||||
|
||||
class AssignedStaffBloc extends Bloc<AssignedStaffEvent, AssignedStaffState> {
|
||||
AssignedStaffBloc(
|
||||
{required List<StaffContact> staffContacts, required String department})
|
||||
: super(AssignedStaffState(
|
||||
staffContacts: staffContacts,
|
||||
department: department,
|
||||
)) {}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
part of 'assigned_staff_bloc.dart';
|
||||
|
||||
@immutable
|
||||
sealed class AssignedStaffEvent {}
|
||||
@@ -0,0 +1,23 @@
|
||||
part of 'assigned_staff_bloc.dart';
|
||||
|
||||
@immutable
|
||||
class AssignedStaffState {
|
||||
final List<StaffContact> staffContacts;
|
||||
final String department;
|
||||
final bool inLoading;
|
||||
|
||||
const AssignedStaffState({required this.staffContacts, required this.department, this.inLoading = false});
|
||||
|
||||
copyWith({
|
||||
List<StaffContact>? staffContacts,
|
||||
String? department,
|
||||
bool? canManualAssign,
|
||||
bool? inLoading,
|
||||
}) {
|
||||
return AssignedStaffState(
|
||||
staffContacts: staffContacts ?? this.staffContacts,
|
||||
department: department ?? this.department,
|
||||
inLoading: inLoading ?? this.inLoading,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow/core/entity/staff_contact_entity.dart';
|
||||
import 'package:krow/core/presentation/widgets/assigned_staff_item_widget.dart';
|
||||
import 'package:krow/core/presentation/widgets/ui_kit/kw_app_bar.dart';
|
||||
import 'package:krow/features/assigned_staff_screen/domain/assigned_staff_bloc.dart';
|
||||
|
||||
@RoutePage()
|
||||
class AssignedStaffScreen extends StatelessWidget implements AutoRouteWrapper {
|
||||
final List<StaffContact> staffContacts;
|
||||
|
||||
final String department;
|
||||
|
||||
const AssignedStaffScreen(
|
||||
{super.key, required this.staffContacts, required this.department});
|
||||
|
||||
@override
|
||||
Widget wrappedRoute(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => AssignedStaffBloc(
|
||||
staffContacts: staffContacts, department: department),
|
||||
child: this);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<AssignedStaffBloc, AssignedStaffState>(
|
||||
builder: (context, state) {
|
||||
return Scaffold(
|
||||
appBar: KwAppBar(
|
||||
titleText: 'Assigned Staff',
|
||||
),
|
||||
body: ListView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: staffContacts.length,
|
||||
itemBuilder: (context, index) {
|
||||
return AssignedStaffItemWidget(
|
||||
staffContact: staffContacts[index], department: department);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user