setting page inprogress

merge-update-with-lab-changes
Sultan Khan 5 years ago
parent 4c8c4e3725
commit d2f391ab7f

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:diplomaticquarterapp/theme/theme_notifier.dart';
import 'package:diplomaticquarterapp/theme/theme_value.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
@ -24,7 +25,7 @@ class _GeneralSettings extends State<GeneralSettings>
bool camera =false;
bool location =false;
var sharedPref = new AppSharedPreferences();
var permission = new PermissionService();
@override
void initState() {
getValues();
@ -256,16 +257,16 @@ class _GeneralSettings extends State<GeneralSettings>
}
break;
}
sharedPref.setInt(THEME_VALUE, value);
permission.setTheme(value);
}
setVibration(value){
sharedPref.setBool(IS_VIBRATION, value);
permission.setVibrationPermission(value);
}
getValues() async{
blindValue= await sharedPref.getInt(THEME_VALUE) ?? 0;
vibration= await sharedPref.getBool(IS_VIBRATION) ?? false;
blindValue= permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled();
vibration = permission.isVibrationEnabled() ==null ? false : permission.isVibrationEnabled();
}
getTheme(value) async{
if(value ==1){

@ -6,11 +6,27 @@ import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart';
import 'package:localstorage/localstorage.dart';
class PermissionService extends BaseService {
AppSharedPreferences sharedPref = AppSharedPreferences();
final LocalStorage storage = new LocalStorage("permission");
AppGlobal appGlobal = new AppGlobal();
setVibrationPermission(flag) async {
storage.setItem('isVibration', flag);
}
isVibrationEnabled() {
return storage.getItem('isVibration');
}
setTheme(flag) async {
storage.setItem('isTheme', flag);
}
isThemeEnabled() {
return storage.getItem('isTheme');
}
}

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
/// Button widget
@ -33,7 +35,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
double _buttonSize = 1.0;
AnimationController _animationController;
Animation _animation;
PermissionService permission = new PermissionService();
@override
void initState() {
_animationController = AnimationController(
@ -88,7 +90,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
onTapCancel: () {
_animationController.forward();
},
onTap: Feedback.wrapForTap(widget.onTap, context),
onTap: (){Feedback.wrapForTap(widget.onTap, context); if(permission.isVibrationEnabled()){ HapticFeedback.vibrate();}},
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

@ -1,12 +1,15 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class DefaultButton extends StatelessWidget {
final String text;
final Function onPress;
final Color textColor;
final Color color;
PermissionService permission = new PermissionService();
DefaultButton(this.text, this.onPress, {this.color, this.textColor});
@override
Widget build(BuildContext context) {
@ -21,6 +24,6 @@ class DefaultButton extends StatelessWidget {
this.text,
style: TextStyle(fontSize: SizeConfig.textMultiplier * 2),
),
onPressed: () => this.onPress()));
onPressed: () =>{ this.onPress(), if(permission.isVibrationEnabled()){ HapticFeedback.vibrate()}}));
}
}

@ -40,6 +40,7 @@ dependencies:
# Native
flutter_device_type: ^0.2.0
local_auth: ^0.6.2+3
localstorage: ^3.0.3+6
maps_launcher: ^1.2.1
url_launcher: ^5.5.0
shared_preferences: ^0.5.8

Loading…
Cancel
Save