57 lines
1.8 KiB
Dart
57 lines
1.8 KiB
Dart
|
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/sos/sos_bloc.dart';
|
||
|
import 'package:unit2/screens/sos/components/add_mobile.dart';
|
||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||
|
|
||
|
class SosScreen extends StatefulWidget {
|
||
|
const SosScreen({super.key});
|
||
|
|
||
|
@override
|
||
|
State<SosScreen> createState() => _SosScreenState();
|
||
|
}
|
||
|
|
||
|
class _SosScreenState extends State<SosScreen> {
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return SafeArea(
|
||
|
child: Scaffold(
|
||
|
resizeToAvoidBottomInset: true,
|
||
|
appBar: AppBar(
|
||
|
title: const Text("SOS"),
|
||
|
centerTitle: true,
|
||
|
backgroundColor: primary,
|
||
|
),
|
||
|
body: ProgressHUD(
|
||
|
padding: const EdgeInsets.all(24),
|
||
|
backgroundColor: Colors.black87,
|
||
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||
|
child: BlocConsumer<SosBloc,SosState>(
|
||
|
listener: (context, state) {
|
||
|
//// user location loaded
|
||
|
if (state is UserLocationLoaded) {
|
||
|
Navigator.push(context,
|
||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||
|
return AddMobile();
|
||
|
}));
|
||
|
}
|
||
|
////loading state
|
||
|
if (state is LoadingState) {
|
||
|
final progress = ProgressHUD.of(context);
|
||
|
progress!.showWithText("Please wait...");
|
||
|
}
|
||
|
},
|
||
|
builder: (context, state) {
|
||
|
if (state is ErrorState) {}
|
||
|
return Container();
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
));
|
||
|
}
|
||
|
}
|