26-02-1403 / Rhmn / Backup before Home-Widget.
This commit is contained in:
parent
48ccf55040
commit
d4afdeb688
|
|
@ -14,8 +14,11 @@ class ActionSheetData {
|
|||
final bool hasConfirmButton;
|
||||
final bool withoutButtonMode;
|
||||
final bool smallDismissButton;
|
||||
final bool isBackgroundDropBlur;
|
||||
final Color? backgroundColor;
|
||||
|
||||
const ActionSheetData({
|
||||
|
||||
const ActionSheetData( {
|
||||
required this.content,
|
||||
this.title,
|
||||
this.confrimTitle,
|
||||
|
|
@ -29,5 +32,7 @@ class ActionSheetData {
|
|||
this.onDismissed,
|
||||
this.smallDismissButton = false,
|
||||
this.withoutButtonMode = false,
|
||||
this.isBackgroundDropBlur = false,
|
||||
this.backgroundColor,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ class RequestService {
|
|||
}) {
|
||||
if (body != null) _requestBody = body;
|
||||
if (requestHeaders != null) _headers.addAll(requestHeaders);
|
||||
// if (useAutherization) _headers.addAll({'Authorization': 'Bearer $token'});
|
||||
_headers.addAll({
|
||||
'Authorization':
|
||||
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicm9sZUlkIjo0LCJhcHBJZCI6MCwiaWF0IjoxNzEzOTM1NzkwfQ.i-SO9tLy0M9j-_C2Wh8tdp01vtYGlDZIBFPygglHQF0'
|
||||
});
|
||||
if (useAutherization) _headers.addAll({'Authorization': 'Bearer $token'});
|
||||
// _headers.addAll({
|
||||
// 'Authorization':
|
||||
// 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicm9sZUlkIjo0LCJhcHBJZCI6MCwiaWF0IjoxNzEzOTM1NzkwfQ.i-SO9tLy0M9j-_C2Wh8tdp01vtYGlDZIBFPygglHQF0'
|
||||
// });
|
||||
if (body != null) _requestBody = body;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:didvan/config/design_config.dart';
|
||||
|
|
@ -91,7 +92,7 @@ class ActionSheetUtils {
|
|||
constraints: BoxConstraints(
|
||||
maxWidth: mediaQueryData.size.width,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
backgroundColor: data.backgroundColor ?? Colors.transparent,
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
builder: (context) => Container(
|
||||
|
|
@ -178,78 +179,87 @@ class ActionSheetUtils {
|
|||
static Future<void> openDialog({required ActionSheetData data}) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) => Dialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: DesignConfig.mediumBorderRadius,
|
||||
),
|
||||
child: Container(
|
||||
width: mediaQueryData.size.width * 0.8,
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (data.title != null)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (data.titleIcon != null)
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Icon(
|
||||
data.titleIcon,
|
||||
size: 20,
|
||||
builder: (context) => BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: data.isBackgroundDropBlur? 10 : 0, sigmaY: data.isBackgroundDropBlur? 10: 0) ,
|
||||
child: Dialog(
|
||||
backgroundColor:
|
||||
data.backgroundColor ?? Theme.of(context).colorScheme.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: DesignConfig.mediumBorderRadius,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: DesignConfig.mediumBorderRadius,
|
||||
color:
|
||||
data.backgroundColor ?? Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
width: mediaQueryData.size.width * 0.8,
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (data.title != null)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (data.titleIcon != null)
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Icon(
|
||||
data.titleIcon,
|
||||
size: 20,
|
||||
color: data.titleColor,
|
||||
),
|
||||
),
|
||||
if (data.titleIcon != null)
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Expanded(
|
||||
child: DidvanText(
|
||||
data.title!,
|
||||
style: Theme.of(context).textTheme.displaySmall,
|
||||
color: data.titleColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
if (data.titleIcon != null)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
data.content,
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
if (data.hasDismissButton)
|
||||
Expanded(
|
||||
child: DidvanButton(
|
||||
onPressed: data.onDismissed ?? () => pop(),
|
||||
title: data.dismissTitle ?? 'بازگشت',
|
||||
style: ButtonStyleMode.flat,
|
||||
),
|
||||
),
|
||||
if (data.hasDismissButton)
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: DidvanText(
|
||||
data.title!,
|
||||
style: Theme.of(context).textTheme.displaySmall,
|
||||
color: data.titleColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
child: DidvanButton(
|
||||
onPressed: () {
|
||||
pop();
|
||||
data.onConfirmed?.call();
|
||||
},
|
||||
title: data.confrimTitle ?? 'تایید',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
data.content,
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
if (data.hasDismissButton)
|
||||
Expanded(
|
||||
child: DidvanButton(
|
||||
onPressed: data.onDismissed ?? () => pop(),
|
||||
title: data.dismissTitle ?? 'بازگشت',
|
||||
style: ButtonStyleMode.flat,
|
||||
),
|
||||
),
|
||||
if (data.hasDismissButton)
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: DidvanButton(
|
||||
onPressed: () {
|
||||
pop();
|
||||
data.onConfirmed?.call();
|
||||
},
|
||||
title: data.confrimTitle ?? 'تایید',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import 'package:didvan/config/theme_data.dart';
|
||||
import 'package:didvan/constants/app_icons.dart';
|
||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||
import 'package:didvan/providers/server_data.dart';
|
||||
import 'package:didvan/providers/user.dart';
|
||||
|
|
@ -8,6 +10,7 @@ import 'package:didvan/views/authentication/widgets/authentication_layout.dart';
|
|||
import 'package:didvan/views/widgets/didvan/button.dart';
|
||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||
import 'package:didvan/views/widgets/didvan/text_field.dart';
|
||||
import 'package:didvan/views/widgets/ink_wrapper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
|
@ -79,25 +82,74 @@ class _PasswordInputState extends State<PasswordInput> {
|
|||
if (mounted) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.home);
|
||||
}
|
||||
_showCustomizeDialog();
|
||||
_showResetPasswordDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void _showResetPasswordDialog() {
|
||||
ActionSheetUtils.openDialog(
|
||||
|
||||
data: ActionSheetData(
|
||||
content: const DidvanText(
|
||||
'خوش آمدید!\nبرای امنیت بیشتر، رمز عبور خود را تغییر دهید.',
|
||||
),
|
||||
title: 'تغییر رمز عبور',
|
||||
onConfirmed: () => Navigator.of(ActionSheetUtils.context).pushNamed(
|
||||
Routes.authenticaion,
|
||||
arguments: true,
|
||||
),
|
||||
isBackgroundDropBlur: false,
|
||||
confrimTitle: 'تغییر رمز عبور',
|
||||
onDismissed: Navigator.of(ActionSheetUtils.context).pop,
|
||||
dismissTitle: 'بعدا',
|
||||
),
|
||||
);
|
||||
}
|
||||
void _showCustomizeDialog() {
|
||||
ActionSheetUtils.openDialog(
|
||||
data: ActionSheetData(
|
||||
backgroundColor: Colors.white,
|
||||
isBackgroundDropBlur: true,
|
||||
|
||||
content: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWrapper(
|
||||
onPressed: () => Navigator.of(ActionSheetUtils.context).pop,
|
||||
child: const Icon(
|
||||
DidvanIcons.close_solid,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
DidvanText(
|
||||
'شخصی سازی برنامه',
|
||||
style: Theme.of(context).textTheme.displaySmall,
|
||||
color: Theme.of(context).colorScheme.title,
|
||||
),
|
||||
const Icon(
|
||||
DidvanIcons.close_regular,
|
||||
size: 24,
|
||||
color: Colors.transparent,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
const DidvanText(
|
||||
"کاربر گرامی\nدر جهت استفاده بهتر و مفیدتر از برنامه لطفا دستهبندیهای مورد علاقه خود و زمان دریافت اعلانات را انتخاب کنید")
|
||||
],
|
||||
),
|
||||
hasDismissButton: false,
|
||||
onConfirmed: () => Navigator.of(ActionSheetUtils.context).pushNamed(
|
||||
Routes.favouritesStep,
|
||||
arguments: true,
|
||||
),
|
||||
confrimTitle: 'تایید',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,19 @@
|
|||
import 'package:didvan/config/design_config.dart';
|
||||
import 'package:didvan/config/theme_data.dart';
|
||||
import 'package:didvan/constants/app_icons.dart';
|
||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||
import 'package:didvan/providers/theme.dart';
|
||||
import 'package:didvan/routes/routes.dart';
|
||||
import 'package:didvan/services/app_initalizer.dart';
|
||||
import 'package:didvan/utils/action_sheet.dart';
|
||||
import 'package:didvan/views/home/bookmarks/bookmarks.dart';
|
||||
import 'package:didvan/views/home/categories/categories_page.dart';
|
||||
import 'package:didvan/views/home/main/main_page.dart';
|
||||
import 'package:didvan/views/home/home_state.dart';
|
||||
import 'package:didvan/views/home/new_statistic/new_statistic.dart';
|
||||
import 'package:didvan/views/home/search/search.dart';
|
||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||
import 'package:didvan/views/widgets/ink_wrapper.dart';
|
||||
import 'package:didvan/views/widgets/logo_app_bar.dart';
|
||||
import 'package:didvan/views/widgets/didvan/bnb.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -38,9 +45,12 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
|
|||
context.read<ThemeProvider>().addListener(() {
|
||||
state.refresh();
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final state = context.read<GeneralSettingsState>();
|
||||
Future.delayed(
|
||||
Duration.zero,
|
||||
|
|
|
|||
Loading…
Reference in New Issue