first commit
This commit is contained in:
76
lib/screens/dialogs/dialog_header.dart
Normal file
76
lib/screens/dialogs/dialog_header.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/gen/assets.gen.dart';
|
||||
|
||||
class DialogHeader extends StatelessWidget {
|
||||
const DialogHeader({
|
||||
super.key,
|
||||
this.title = '',
|
||||
this.paddingSize = 28,
|
||||
this.action,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final double paddingSize;
|
||||
final Widget? action;
|
||||
|
||||
// Константы для стилей и отступов
|
||||
static final double _headerHeight = 56.h;
|
||||
static const BoxDecoration _headerDecoration = BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: AppColors.gray, width: 0.5)),
|
||||
);
|
||||
static final _medium16Style = Medium16px();
|
||||
static final double _iconSize = 24.r;
|
||||
static const BoxDecoration _closeButtonDecoration = BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.bg,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: _headerHeight.h,
|
||||
decoration: _headerDecoration,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: paddingSize).r,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
_buildTitle(),
|
||||
if (action != null) action!,
|
||||
_buildCloseButton(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение заголовка диалога
|
||||
Widget _buildTitle() {
|
||||
return AppTypography(title, type: _medium16Style);
|
||||
}
|
||||
|
||||
/// Построение кнопки закрытия диалога
|
||||
Widget _buildCloseButton(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
height: _iconSize.h,
|
||||
width: _iconSize.w,
|
||||
decoration: _closeButtonDecoration,
|
||||
child: Center(
|
||||
child: Assets.icons.typeClose.image(
|
||||
color: AppColors.gray,
|
||||
height: _iconSize.h,
|
||||
width: _iconSize.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
69
lib/screens/dialogs/dialog_item.dart
Normal file
69
lib/screens/dialogs/dialog_item.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
|
||||
class DialogItem extends StatelessWidget {
|
||||
const DialogItem({
|
||||
super.key,
|
||||
required this.onTap,
|
||||
this.child,
|
||||
this.title = '',
|
||||
this.dimension = 24,
|
||||
this.color,
|
||||
});
|
||||
|
||||
final VoidCallback? onTap;
|
||||
final Widget? child;
|
||||
final String title;
|
||||
final Color? color;
|
||||
final double dimension;
|
||||
|
||||
// Константы для стилей и отступов
|
||||
static final double _itemHeight = 56.h;
|
||||
static const BoxDecoration _itemDecoration = BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: AppColors.gray, width: 0.5)),
|
||||
);
|
||||
static final EdgeInsetsGeometry _itemPadding =
|
||||
EdgeInsets.symmetric(horizontal: 28).r;
|
||||
static final EdgeInsetsGeometry _iconPadding = EdgeInsets.only(right: 8).r;
|
||||
static final _regular17Style = Regular17px();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: _itemHeight.h,
|
||||
decoration: _itemDecoration,
|
||||
child: Padding(
|
||||
padding: _itemPadding,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[_buildIcon(), _buildTitle()],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение иконки
|
||||
Widget _buildIcon() {
|
||||
return Padding(
|
||||
padding: _iconPadding,
|
||||
child: SizedBox.square(dimension: dimension.r, child: child),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение заголовка
|
||||
Widget _buildTitle() {
|
||||
return AppTypography(
|
||||
title,
|
||||
color: color ?? AppColors.black,
|
||||
type: _regular17Style,
|
||||
);
|
||||
}
|
||||
}
|
||||
61
lib/screens/dialogs/filters_dialog.dart
Normal file
61
lib/screens/dialogs/filters_dialog.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remever/common/widgets/bottom_safe_space.dart';
|
||||
import 'package:remever/gen/assets.gen.dart';
|
||||
import 'package:remever/screens/dialogs/dialog_header.dart';
|
||||
import 'package:remever/screens/dialogs/dialog_item.dart';
|
||||
|
||||
class FiltersDialog extends StatelessWidget {
|
||||
const FiltersDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
const DialogHeader(title: 'Сортировка'),
|
||||
DialogItem(
|
||||
title: 'Сначала Мои коллекции',
|
||||
child: Assets.icons.typeSortA.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'Сначала коллекции на изучении',
|
||||
child: Assets.icons.typeSortA.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'По дате обновления',
|
||||
child: Assets.icons.typeSortDown.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'По уровню изученности',
|
||||
child: Assets.icons.typeSortDown.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'По популярностии',
|
||||
child: Assets.icons.typeSortDown.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'По количеству карточек',
|
||||
child: Assets.icons.typeSortDown.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
const BottomSafeSpace(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user