Доработка деталки коллекции
This commit is contained in:
@@ -36,7 +36,7 @@ class _TicketCardState extends State<TicketCard> {
|
||||
context: context,
|
||||
height: 262.h,
|
||||
builder:
|
||||
(BuildContext context) => const AlertInfoDialog(
|
||||
(_) => const AlertInfoDialog(
|
||||
title: 'Вы хотите удалить карточку?\nЭто действие необратимо',
|
||||
acceptTitle: 'Да, удалить',
|
||||
declineTitle: 'Нет, оставить',
|
||||
@@ -49,7 +49,7 @@ class _TicketCardState extends State<TicketCard> {
|
||||
context: context,
|
||||
height: 394.h,
|
||||
backgroundColor: AppColors.gray_bg,
|
||||
builder: (BuildContext context) => const ReplaceDialog(),
|
||||
builder: (_) => const ReplaceDialog(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,42 +66,39 @@ class _TicketCardState extends State<TicketCard> {
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.62,
|
||||
motion: const StretchMotion(),
|
||||
children: <Widget>[
|
||||
children: [
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: const Color(0xFFFFE4E6),
|
||||
foregroundColor: const Color(0xFFFF5C69),
|
||||
icon: CupertinoIcons.trash,
|
||||
onPressed: () => _onDeleteTap(),
|
||||
Colors.red.shade50,
|
||||
Colors.red,
|
||||
CupertinoIcons.trash,
|
||||
_onDeleteTap,
|
||||
),
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: const Color(0xFFD7E6F4),
|
||||
foregroundColor: const Color(0xFF0058AB),
|
||||
icon: CupertinoIcons.repeat,
|
||||
onPressed: () => _onRollTap(),
|
||||
Colors.blue.shade50,
|
||||
Colors.blue,
|
||||
CupertinoIcons.repeat,
|
||||
_onRollTap,
|
||||
),
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: AppColors.secondary,
|
||||
foregroundColor: AppColors.primary,
|
||||
icon: CupertinoIcons.move,
|
||||
onPressed: () => _onReplaceTap(),
|
||||
AppColors.secondary,
|
||||
AppColors.primary,
|
||||
CupertinoIcons.move,
|
||||
_onReplaceTap,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)).r,
|
||||
borderRadius: BorderRadius.circular(12).r,
|
||||
color: Colors.white,
|
||||
),
|
||||
constraints: BoxConstraints(minHeight: 50.h),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
width: double.infinity,
|
||||
@@ -109,16 +106,12 @@ class _TicketCardState extends State<TicketCard> {
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(12).r,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
_buildImage(),
|
||||
_buildText(context),
|
||||
_buildEditButton(),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildImage(),
|
||||
Expanded(child: _buildText(context)),
|
||||
_buildEditButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -129,7 +122,6 @@ class _TicketCardState extends State<TicketCard> {
|
||||
);
|
||||
}
|
||||
|
||||
/// Кнопка редактирования
|
||||
Widget _buildEditButton() {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
@@ -137,16 +129,12 @@ class _TicketCardState extends State<TicketCard> {
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Кнопка в меню свайпа
|
||||
///
|
||||
Widget _buildSlidableAction({
|
||||
required BuildContext context,
|
||||
required Color backgroundColor,
|
||||
required Color foregroundColor,
|
||||
required IconData icon,
|
||||
required VoidCallback onPressed,
|
||||
}) {
|
||||
Widget _buildSlidableAction(
|
||||
Color backgroundColor,
|
||||
Color foregroundColor,
|
||||
IconData icon,
|
||||
VoidCallback onPressed,
|
||||
) {
|
||||
return SlidableAction(
|
||||
borderRadius: BorderRadius.circular(12).r,
|
||||
onPressed: (_) => onPressed(),
|
||||
@@ -157,62 +145,33 @@ class _TicketCardState extends State<TicketCard> {
|
||||
}
|
||||
|
||||
Widget _buildText(BuildContext context) {
|
||||
return Expanded(
|
||||
child: ReadMoreText(
|
||||
isExpandable: true,
|
||||
_isRolled ? widget.ticket.answer : widget.ticket.question,
|
||||
trimMode: TrimMode.Line,
|
||||
trimLines: 3,
|
||||
trimCollapsedText: '\nРазвернуть',
|
||||
trimExpandedText: '\nСвернуть',
|
||||
style: Regular16px().style,
|
||||
moreStyle: Regular12px().style.copyWith(color: AppColors.primary_blue),
|
||||
lessStyle: Regular12px().style.copyWith(color: AppColors.primary_blue),
|
||||
),
|
||||
return ReadMoreText(
|
||||
_isRolled ? widget.ticket.answer : widget.ticket.question,
|
||||
trimMode: TrimMode.Line,
|
||||
trimLines: 3,
|
||||
trimCollapsedText: '\nРазвернуть',
|
||||
trimExpandedText: '\nСвернуть',
|
||||
style: Regular16px().style,
|
||||
moreStyle: Regular12px().style.copyWith(color: AppColors.primary_blue),
|
||||
lessStyle: Regular12px().style.copyWith(color: AppColors.primary_blue),
|
||||
);
|
||||
}
|
||||
|
||||
/// Картинка
|
||||
Widget _buildImage() {
|
||||
final imageBytes =
|
||||
_isRolled ? widget.ticket.answerImage : widget.ticket.questionImage;
|
||||
return Wif(
|
||||
condition: _isRolled,
|
||||
condition: imageBytes != null,
|
||||
builder:
|
||||
(context) => Wif(
|
||||
condition: widget.ticket.answerImage != null,
|
||||
builder: (BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 8).r,
|
||||
child: SizedBox.square(
|
||||
dimension: 64.r,
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)).r,
|
||||
child: Image.memory(
|
||||
widget.ticket.answerImage!,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
fallback:
|
||||
(context) => Wif(
|
||||
condition: widget.ticket.questionImage != null,
|
||||
builder: (BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 8).r,
|
||||
child: SizedBox.square(
|
||||
dimension: 64.r,
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)).r,
|
||||
child: Image.memory(
|
||||
widget.ticket.questionImage!,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
(context) => Padding(
|
||||
padding: const EdgeInsets.only(right: 8).r,
|
||||
child: SizedBox.square(
|
||||
dimension: 64.r,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8).r,
|
||||
child: Image.memory(imageBytes!, fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -220,15 +179,15 @@ class _TicketCardState extends State<TicketCard> {
|
||||
/// Декорирование контейнера
|
||||
BoxDecoration getDecoration() {
|
||||
return BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)).r,
|
||||
borderRadius: BorderRadius.circular(12).r,
|
||||
gradient: LinearGradient(
|
||||
colors: <Color>[
|
||||
colors: [
|
||||
_isRolled ? AppColors.answer : AppColors.question,
|
||||
Colors.white,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: const Alignment(-0.6, 1),
|
||||
stops: const <double>[0.25, 0.25],
|
||||
stops: const [0.25, 0.25],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user