6/27/1
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:vibration/vibration.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
|
||||
class MyElevatedButton extends StatelessWidget {
|
||||
final String title;
|
||||
final VoidCallback onPressed;
|
||||
final Color kolor;
|
||||
final int vibrateDuration;
|
||||
|
||||
const MyElevatedButton({
|
||||
Key? key,
|
||||
required this.title,
|
||||
@@ -24,28 +23,23 @@ class MyElevatedButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool vibrate = box.read(BoxName.isvibrate) ?? true;
|
||||
final bool vibrate = box.read(BoxName.isvibrate) ?? true;
|
||||
|
||||
return ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(kolor),
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: kolor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
)),
|
||||
// padding:
|
||||
// MaterialStateProperty.all(const EdgeInsets.symmetric(vertical: 15)),
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
// Handle haptic feedback for both iOS and Android
|
||||
if (vibrate) {
|
||||
if (Platform.isIOS) {
|
||||
HapticFeedback.selectionClick();
|
||||
} else {
|
||||
Vibration.vibrate(duration: 100);
|
||||
// Vibrate.vibrateWithPauses(pauses);
|
||||
await Vibration.vibrate(duration: vibrateDuration);
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the onPressed callback is called after haptic feedback
|
||||
onPressed();
|
||||
},
|
||||
child: Text(
|
||||
|
||||
@@ -20,7 +20,7 @@ class IconWidgetMenu extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: onpressed,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 25),
|
||||
padding: const EdgeInsets.only(top: 1),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@@ -29,22 +29,22 @@ class IconWidgetMenu extends StatelessWidget {
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.secondaryColor,
|
||||
offset: Offset(-2, -2),
|
||||
blurRadius: 0,
|
||||
spreadRadius: 0,
|
||||
blurStyle: BlurStyle.outer,
|
||||
),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(3, 3),
|
||||
blurRadius: 0,
|
||||
spreadRadius: 0,
|
||||
blurStyle: BlurStyle.outer,
|
||||
),
|
||||
],
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// color: AppColor.secondaryColor,
|
||||
// offset: Offset(-2, -2),
|
||||
// blurRadius: 0,
|
||||
// spreadRadius: 0,
|
||||
// blurStyle: BlurStyle.outer,
|
||||
// ),
|
||||
// BoxShadow(
|
||||
// color: AppColor.accentColor,
|
||||
// offset: Offset(3, 3),
|
||||
// blurRadius: 0,
|
||||
// spreadRadius: 0,
|
||||
// blurStyle: BlurStyle.outer,
|
||||
// ),
|
||||
// ],
|
||||
),
|
||||
child: Center(
|
||||
child: Icon(
|
||||
@@ -56,7 +56,7 @@ class IconWidgetMenu extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
style: AppStyle.subtitle,
|
||||
style: AppStyle.subtitle.copyWith(color: AppColor.secondaryColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -25,7 +25,7 @@ class MyCircularProgressIndicator extends StatelessWidget {
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Image.asset('assets/images/logo.png'),
|
||||
child: Image.asset('assets/images/logo.gif'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user