Skip to content

Commit

Permalink
rkverma2022/Refresh Enhancement: Transparent Floating Button Added to…
Browse files Browse the repository at this point in the history
… Synchronize Data savitore#6
  • Loading branch information
rkverma2022 committed Jan 11, 2024
1 parent 37ba702 commit fe1d5a8
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions lib/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class _HomeState extends State<Home> {
}
}

bool pressedToRefreshThePage = false;

@override
Widget build(BuildContext context) {
return BlocProvider(
Expand Down Expand Up @@ -189,6 +191,26 @@ class _HomeState extends State<Home> {
],
),
),
floatingActionButton: ClipOval(
child: FloatingActionButton(
backgroundColor: Color.fromARGB(70, 186, 175, 175),
splashColor: Colors.black,
heroTag: "refresh-3",
onPressed: () async {
setState(() {
pressedToRefreshThePage = true;
});
refresh(context, state);
await Future.delayed(const Duration(seconds: 10));
setState(() {
pressedToRefreshThePage = false;
});
},
child: pressedToRefreshThePage
? const CircularProgressIndicator()
: const Icon(Icons.rotate_right_rounded),
),
),
);
} else if (state is SatelliteLoadedState) {
List<SatelliteModel> satellites = state.satellites;
Expand Down Expand Up @@ -257,6 +279,26 @@ class _HomeState extends State<Home> {
]))
],
),
floatingActionButton: ClipOval(
child: FloatingActionButton(
splashColor: Colors.black,
backgroundColor: Color.fromARGB(70, 114, 101, 101),
heroTag: "refresh-1",
onPressed: () async {
setState(() {
pressedToRefreshThePage = true;
});
refresh(context, state);
await Future.delayed(const Duration(seconds: 10));
setState(() {
pressedToRefreshThePage = false;
});
},
child: pressedToRefreshThePage
? const CircularProgressIndicator()
: const Icon(Icons.rotate_right_rounded),
),
),
bottomNavigationBar: bottomRow(context, state),
);
} else if (state is FilteredSatelliteState) {
Expand Down Expand Up @@ -346,6 +388,26 @@ class _HomeState extends State<Home> {
]))
],
),
floatingActionButton: ClipOval(
child: FloatingActionButton(
splashColor: Colors.black,
backgroundColor: Color.fromARGB(70, 114, 101, 101),
heroTag: "refresh-2",
onPressed: () async {
setState(() {
pressedToRefreshThePage = true;
});
refresh(context, state);
await Future.delayed(const Duration(seconds: 10));
setState(() {
pressedToRefreshThePage = false;
});
},
child: pressedToRefreshThePage
? const CircularProgressIndicator()
: const Icon(Icons.rotate_right_rounded),
),
),
bottomNavigationBar: bottomRow(context, state),
);
}
Expand Down

0 comments on commit fe1d5a8

Please sign in to comment.