-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds No Internet Connectivity screen
- Loading branch information
Showing
13 changed files
with
140 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extensions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ enum NavigateTo { | |
inital, | ||
showLoginScreen, | ||
showHomeScreen, | ||
showNoInternetScreen, | ||
} | ||
|
||
class AppState { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:appetizer/domain/models/user/user.dart'; | ||
import 'package:appetizer/domain/repositories/user/user_repository.dart'; | ||
import 'package:bloc/bloc.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
|
||
part 'no_internet_event.dart'; | ||
part 'no_internet_state.dart'; | ||
|
||
class NoInternetBloc extends Bloc<NoInternetEvent, NoInternetState> { | ||
final UserRepository repo; | ||
NoInternetBloc({required this.repo}) : super(const NoInternetState()) { | ||
on<ReloadPressed>(_onReloadPressed); | ||
} | ||
|
||
void _onReloadPressed( | ||
ReloadPressed event, Emitter<NoInternetState> emit) async { | ||
try { | ||
User user = await repo.getCurrentUser(); | ||
|
||
} catch (e) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
part of 'no_internet_bloc.dart'; | ||
|
||
class NoInternetEvent extends Equatable { | ||
const NoInternetEvent(); | ||
|
||
@override | ||
List<Object?> get props => []; | ||
} | ||
|
||
class ReloadPressed extends NoInternetEvent { | ||
const ReloadPressed(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
part of 'no_internet_bloc.dart'; | ||
|
||
class NoInternetState extends Equatable { | ||
const NoInternetState(); | ||
|
||
@override | ||
List<Object> get props => []; | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
lib/presentation/no_internet/components/no_internet_banner.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart'; | ||
import 'package:appetizer/presentation/components/app_banner.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:google_fonts/google_fonts.dart'; | ||
|
||
class NoInternetBanner extends StatelessWidget { | ||
const NoInternetBanner({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AppBanner( | ||
height: 140.toAutoScaledHeight, | ||
child: Row( | ||
children: [ | ||
SizedBox( | ||
width: 12.toAutoScaledWidth, | ||
), | ||
Text( | ||
'Appetizer', | ||
style: GoogleFonts.notoSans( | ||
color: Colors.white, | ||
fontSize: 24.toAutoScaledWidth, | ||
fontWeight: FontWeight.w700, | ||
decoration: TextDecoration.none, | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:appetizer/presentation/components/no_data_found_container.dart'; | ||
import 'package:appetizer/presentation/no_internet/components/no_internet_banner.dart'; | ||
import 'package:auto_route/auto_route.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
@RoutePage() | ||
class NoInternetWrapper extends StatelessWidget { | ||
const NoInternetWrapper({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const AutoRouter(); | ||
} | ||
} | ||
|
||
@RoutePage() | ||
class NoInternetScreen extends StatelessWidget { | ||
const NoInternetScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
color: Colors.white, | ||
child: const Column( | ||
children: [ | ||
NoInternetBanner(), | ||
NoDataFoundContainer(title: "No Internet Connection"), | ||
], | ||
), | ||
); | ||
} | ||
} |