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