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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user