Add loading gif for app
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/mihLoadingCircle.dart';
|
||||
import 'package:patient_manager/env/env.dart';
|
||||
import 'package:patient_manager/objects/arguments.dart';
|
||||
import 'package:patient_manager/objects/patients.dart';
|
||||
@@ -49,7 +50,7 @@ class _AddOrViewPatientState extends State<AddOrViewPatient> {
|
||||
future: fetchPatient(),
|
||||
builder: (ctx, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
return const Mihloadingcircle();
|
||||
}
|
||||
// Checking if future is resolved
|
||||
else if (snapshot.connectionState == ConnectionState.done) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:patient_manager/components/homeTile.dart';
|
||||
import 'package:patient_manager/components/mihAppBar.dart';
|
||||
import 'package:patient_manager/components/mihAppDrawer.dart';
|
||||
import 'package:patient_manager/components/mihDeleteMessage.dart';
|
||||
import 'package:patient_manager/components/mihLoadingCircle.dart';
|
||||
import 'package:patient_manager/components/myErrorMessage.dart';
|
||||
import 'package:patient_manager/components/mySuccessMessage.dart';
|
||||
import 'package:patient_manager/env/env.dart';
|
||||
@@ -154,6 +155,20 @@ class _HomeTileGridState extends State<HomeTileGrid> {
|
||||
|
||||
void setAppsDev(List<List<dynamic>> tileList) {
|
||||
if (AppEnviroment.getEnv() == "Dev") {
|
||||
tileList.add(
|
||||
[
|
||||
Icons.change_circle,
|
||||
"Loading - Dev",
|
||||
() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const Mihloadingcircle();
|
||||
},
|
||||
);
|
||||
}
|
||||
],
|
||||
);
|
||||
tileList.add(
|
||||
[
|
||||
Icons.add_business_outlined,
|
||||
@@ -312,7 +327,7 @@ class _HomeTileGridState extends State<HomeTileGrid> {
|
||||
appBar: const MIHAppBar(barTitle: "Mzansi Innovation Hub"),
|
||||
drawer: MIHAppDrawer(
|
||||
signedInUser: widget.signedInUser,
|
||||
logo: MzanziInnovationHub.of(context)!.theme.logoImage(), //logo,
|
||||
//logo: MzanziInnovationHub.of(context)!.theme.logoImage(), //logo,
|
||||
),
|
||||
body: FutureBuilder(
|
||||
future: pbswitch,
|
||||
@@ -337,9 +352,7 @@ class _HomeTileGridState extends State<HomeTileGrid> {
|
||||
),
|
||||
);
|
||||
}
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
return const Mihloadingcircle();
|
||||
},
|
||||
),
|
||||
bottomNavigationBar: Visibility(
|
||||
@@ -380,11 +393,5 @@ class _HomeTileGridState extends State<HomeTileGrid> {
|
||||
),
|
||||
),
|
||||
);
|
||||
// }
|
||||
// return const Center(
|
||||
// child: CircularProgressIndicator(),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/buildMedList.dart';
|
||||
import 'package:patient_manager/components/mihLoadingCircle.dart';
|
||||
import 'package:patient_manager/components/myErrorMessage.dart';
|
||||
import 'package:patient_manager/env/env.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
@@ -96,9 +97,7 @@ class _MedicineSearchState extends State<MedicineSearch> {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const SizedBox(
|
||||
height: 400,
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
child: Mihloadingcircle(),
|
||||
);
|
||||
} else if (snapshot.hasData && snapshot.data!.isNotEmpty) {
|
||||
final medsList = snapshot.data!;
|
||||
|
||||
@@ -5,11 +5,11 @@ import 'package:supertokens_flutter/supertokens.dart';
|
||||
|
||||
class MIHAppDrawer extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final AssetImage logo;
|
||||
//final AssetImage logo;
|
||||
const MIHAppDrawer({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.logo,
|
||||
//required this.logo,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -56,6 +56,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
||||
Widget build(BuildContext context) {
|
||||
// precacheImage(
|
||||
// MzanziInnovationHub.of(context)!.theme.logoImage().image, context);
|
||||
ImageProvider logo = MzanziInnovationHub.of(context)!.theme.logoImage();
|
||||
return Drawer(
|
||||
//backgroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
child: Stack(children: [
|
||||
@@ -74,7 +75,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 60,
|
||||
child: Image(image: widget.logo),
|
||||
child: Image(image: logo),
|
||||
),
|
||||
Text(
|
||||
"${widget.signedInUser.fname} ${widget.signedInUser.lname}",
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
import 'package:gif/gif.dart';
|
||||
|
||||
class Mihloadingcircle extends StatefulWidget {
|
||||
const Mihloadingcircle({super.key});
|
||||
|
||||
@override
|
||||
State<Mihloadingcircle> createState() => _MihloadingcircleState();
|
||||
}
|
||||
|
||||
class _MihloadingcircleState extends State<Mihloadingcircle>
|
||||
with TickerProviderStateMixin {
|
||||
late final GifController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = GifController(vsync: this);
|
||||
//_controller.animateTo(26);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ImageProvider loading =
|
||||
MzanziInnovationHub.of(context)!.theme.loadingImage();
|
||||
return Dialog(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
width: 250,
|
||||
height: 250,
|
||||
decoration: BoxDecoration(
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
borderRadius: BorderRadius.circular(25.0),
|
||||
border: Border.all(
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
width: 5.0),
|
||||
),
|
||||
child: Gif(
|
||||
image: loading,
|
||||
controller:
|
||||
_controller, // if duration and fps is null, original gif fps will be used.
|
||||
fps: 15,
|
||||
//duration: const Duration(seconds: 3),
|
||||
autostart: Autostart.loop,
|
||||
placeholder: (context) => const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
onFetchCompleted: () {
|
||||
_controller.reset();
|
||||
_controller.forward();
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// Center(
|
||||
// child: MzanziInnovationHub.of(context)!.theme.loadingImage()),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/buildFilesList.dart';
|
||||
import 'package:patient_manager/components/medCertInput.dart';
|
||||
import 'package:patient_manager/components/mihLoadingCircle.dart';
|
||||
import 'package:patient_manager/components/myErrorMessage.dart';
|
||||
import 'package:patient_manager/components/mySuccessMessage.dart';
|
||||
import 'package:patient_manager/components/myTextInput.dart';
|
||||
@@ -68,9 +69,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
return const Mihloadingcircle();
|
||||
},
|
||||
);
|
||||
|
||||
@@ -130,9 +129,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
return const Mihloadingcircle();
|
||||
},
|
||||
);
|
||||
|
||||
@@ -640,9 +637,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
||||
future: futueFiles,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
return const Mihloadingcircle();
|
||||
} else if (snapshot.hasData) {
|
||||
final filesList = snapshot.data!;
|
||||
return Container(
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/buildNotesList.dart';
|
||||
import 'package:patient_manager/components/mihLoadingCircle.dart';
|
||||
import 'package:patient_manager/components/myErrorMessage.dart';
|
||||
import 'package:patient_manager/components/myMLTextInput.dart';
|
||||
import 'package:patient_manager/components/mySuccessMessage.dart';
|
||||
@@ -266,9 +267,7 @@ class _PatientNotesState extends State<PatientNotes> {
|
||||
future: futueNotes,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
return const Mihloadingcircle();
|
||||
} else if (snapshot.hasData) {
|
||||
final notesList = snapshot.data!;
|
||||
return Container(
|
||||
|
||||
Reference in New Issue
Block a user