passo_mobile_app/lib/screens/docsms/index.dart

53 lines
1.8 KiB
Dart
Raw Normal View History

2023-04-25 07:50:36 +00:00
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:unit2/bloc/docsms/docsms_bloc.dart';
import 'package:unit2/screens/docsms/components/request_receipt.dart';
import 'package:unit2/widgets/error_state.dart';
class AutoReceiveDocument extends StatefulWidget {
const AutoReceiveDocument({super.key});
@override
State<AutoReceiveDocument> createState() => _AutoReceiveDocumentState();
}
class _AutoReceiveDocumentState extends State<AutoReceiveDocument> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(
color: Colors.white,
),
child: BlocConsumer<DocsmsBloc, DocsmsState>(
listener: (context, state) {
if (state is DocSmsLoadingState) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is DocSmsErrorState || state is DocumentLoaded) {
final progress = ProgressHUD.of(context);
progress!.dismiss();
}
},
builder: (context, state) {
if (state is DocumentLoaded) {
return RequetAutoReceipt();
}if(state is DocSmsErrorState){
return SomethingWentWrong(message: state.message.toString(), onpressed: (){});
}
return Container();
},
),
),
);
}
}