feat: get list outlet id
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import 'package:enaklo_pos/core/components/custom_modal_dialog.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/outlet_loader/outlet_loader_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/home/widgets/outlet_card.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class OutletDialog extends StatelessWidget {
|
||||
const OutletDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomModalDialog(
|
||||
title: 'Outlet',
|
||||
subtitle: 'Silahkan pilih outlet',
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0),
|
||||
child: BlocBuilder<OutletLoaderBloc, OutletLoaderState>(
|
||||
builder: (context, state) {
|
||||
return state.maybeWhen(
|
||||
orElse: () => Center(
|
||||
child: Text('Error has occured'),
|
||||
),
|
||||
loading: () => Center(child: CircularProgressIndicator()),
|
||||
error: (message) => Center(
|
||||
child: Text(message),
|
||||
),
|
||||
loaded: (outlets) => Column(
|
||||
children: List.generate(
|
||||
outlets.length,
|
||||
(index) => OutletCard(
|
||||
outlet: outlets[index],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user