-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1347 from Pylons-tech/feat/maintenance_mode
Feat/maintenance mode
- Loading branch information
Showing
16 changed files
with
235 additions
and
11 deletions.
There are no files selected for viewing
Empty file.
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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
|
||
import '../generated/locale_keys.g.dart'; | ||
import '../utils/constants.dart'; | ||
|
||
|
||
class MaintenanceModeBannerWidget extends StatelessWidget { | ||
const MaintenanceModeBannerWidget({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
color: AppColors.kDarkPurple, | ||
padding: EdgeInsets.symmetric(vertical: 3.h, horizontal: 3.w), | ||
child: Text( | ||
LocaleKeys.maintenance_mode_header.tr(), | ||
style: TextStyle( | ||
color: Colors.white, fontSize: 10.sp, fontWeight: FontWeight.w700), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class MaintenanceModeMessageWidget extends StatelessWidget { | ||
const MaintenanceModeMessageWidget({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
width: 1.sw, | ||
height: 110.h, | ||
color: AppColors.kMainBG, | ||
child: Align( | ||
child: Padding( | ||
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 40.w), | ||
child: Container( | ||
padding: EdgeInsets.symmetric(vertical: 5.h, horizontal: 10.w), | ||
color: AppColors.kDarkPurple, | ||
child: Text( | ||
LocaleKeys.maintenance_mode_message.tr(), | ||
style: TextStyle(color: Colors.white, fontSize: 10.sp, fontWeight: FontWeight.w500), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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
89 changes: 89 additions & 0 deletions
89
wallet/test/mocks/maintenance_mode_widgets_test.mocks.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,89 @@ | ||
// Mocks generated by Mockito 5.3.2 from annotations | ||
// in pylons_wallet/test/widget_testing/components/maintenance_mode_widgets_test.dart. | ||
// Do not manually edit this file. | ||
|
||
// ignore_for_file: no_leading_underscores_for_library_prefixes | ||
import 'dart:async' as _i4; | ||
|
||
import 'package:mockito/mockito.dart' as _i1; | ||
import 'package:pylons_wallet/services/third_party_services/remote_config_service/remote_config_service.dart' | ||
as _i3; | ||
import 'package:pylons_wallet/utils/base_env.dart' as _i2; | ||
|
||
// ignore_for_file: type=lint | ||
// ignore_for_file: avoid_redundant_argument_values | ||
// ignore_for_file: avoid_setters_without_getters | ||
// ignore_for_file: comment_references | ||
// ignore_for_file: implementation_imports | ||
// ignore_for_file: invalid_use_of_visible_for_testing_member | ||
// ignore_for_file: prefer_const_constructors | ||
// ignore_for_file: unnecessary_parenthesis | ||
// ignore_for_file: camel_case_types | ||
// ignore_for_file: subtype_of_sealed_class | ||
|
||
class _FakeBaseEnv_0 extends _i1.SmartFake implements _i2.BaseEnv { | ||
_FakeBaseEnv_0( | ||
Object parent, | ||
Invocation parentInvocation, | ||
) : super( | ||
parent, | ||
parentInvocation, | ||
); | ||
} | ||
|
||
/// A class which mocks [RemoteConfigService]. | ||
/// | ||
/// See the documentation for Mockito's code generation for more information. | ||
class MockRemoteConfigService extends _i1.Mock | ||
implements _i3.RemoteConfigService { | ||
MockRemoteConfigService() { | ||
_i1.throwOnMissingStub(this); | ||
} | ||
|
||
@override | ||
_i4.Future<dynamic> init() => (super.noSuchMethod( | ||
Invocation.method( | ||
#init, | ||
[], | ||
), | ||
returnValue: _i4.Future<dynamic>.value(), | ||
) as _i4.Future<dynamic>); | ||
@override | ||
_i2.BaseEnv getBaseEnv() => (super.noSuchMethod( | ||
Invocation.method( | ||
#getBaseEnv, | ||
[], | ||
), | ||
returnValue: _FakeBaseEnv_0( | ||
this, | ||
Invocation.method( | ||
#getBaseEnv, | ||
[], | ||
), | ||
), | ||
) as _i2.BaseEnv); | ||
@override | ||
String getAndroidAppVersion() => (super.noSuchMethod( | ||
Invocation.method( | ||
#getAndroidAppVersion, | ||
[], | ||
), | ||
returnValue: '', | ||
) as String); | ||
@override | ||
String getIOSAppVersion() => (super.noSuchMethod( | ||
Invocation.method( | ||
#getIOSAppVersion, | ||
[], | ||
), | ||
returnValue: '', | ||
) as String); | ||
@override | ||
bool getMaintenanceMode() => (super.noSuchMethod( | ||
Invocation.method( | ||
#getMaintenanceMode, | ||
[], | ||
), | ||
returnValue: false, | ||
) as bool); | ||
} |
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
31 changes: 31 additions & 0 deletions
31
wallet/test/widget_testing/components/maintenance_mode_widgets_test.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:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:pylons_wallet/components/maintenance_mode_widgets.dart'; | ||
import '../extension/size_extension.dart'; | ||
|
||
|
||
void main() { | ||
TestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
testWidgets('test case for maintenance mode banner widget', (tester) async { | ||
await tester.setScreenSize(); | ||
await tester.testAppForWidgetTesting(const Material( | ||
child: MaintenanceModeBannerWidget())); | ||
await tester.pumpAndSettle(); | ||
final maintenanceModeBannerWidget = find.byType(MaintenanceModeBannerWidget); | ||
await tester.ensureVisible(maintenanceModeBannerWidget); | ||
await tester.pumpAndSettle(const Duration(seconds: 5)); | ||
expect(maintenanceModeBannerWidget, findsOneWidget); | ||
}); | ||
|
||
testWidgets('test case for maintenance mode message widget', (tester) async { | ||
await tester.setScreenSize(); | ||
await tester.testAppForWidgetTesting(const Material( | ||
child: MaintenanceModeMessageWidget())); | ||
await tester.pumpAndSettle(); | ||
final maintenanceModeMessageWidget = find.byType(MaintenanceModeMessageWidget); | ||
await tester.ensureVisible(maintenanceModeMessageWidget); | ||
await tester.pumpAndSettle(const Duration(seconds: 5)); | ||
expect(maintenanceModeMessageWidget, findsOneWidget); | ||
}); | ||
} |