Правки + иконка
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
@@ -6,16 +7,31 @@ import 'package:flutter/material.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/common/widgets/w_if.dart';
|
||||
import 'package:remever/common/widgets/wspace.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/database/database.dart';
|
||||
import 'package:remever/gen/assets.gen.dart';
|
||||
import 'package:remever/inject.dart';
|
||||
import 'package:remever/screens/collections/widgets/learning_card.dart';
|
||||
import 'package:remever/screens/dialogs/info_dialog.dart';
|
||||
import 'package:remever/services/tickets/tickets_interface.dart';
|
||||
import 'package:remever/widgets/primary_button.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CollectionDetailScreen extends StatelessWidget {
|
||||
const CollectionDetailScreen({super.key});
|
||||
const CollectionDetailScreen({super.key, required this.collection});
|
||||
|
||||
final Collection collection;
|
||||
|
||||
void _onInfoTap(BuildContext context) {
|
||||
showCupertinoModalBottomSheet(
|
||||
topRadius: const Radius.circular(24).r,
|
||||
backgroundColor: AppColors.white,
|
||||
context: context,
|
||||
builder: (BuildContext _) => InfoDialog(collection: collection),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -43,14 +59,7 @@ class CollectionDetailScreen extends StatelessWidget {
|
||||
title: _buildTitle(),
|
||||
actions: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showCupertinoModalBottomSheet(
|
||||
topRadius: const Radius.circular(24).r,
|
||||
backgroundColor: AppColors.white,
|
||||
context: context,
|
||||
builder: (BuildContext _) => const InfoDialog(),
|
||||
);
|
||||
},
|
||||
onTap: () => _onInfoTap(context),
|
||||
child: Assets.icons.typeDescription.image(height: 24.h, width: 24.w),
|
||||
),
|
||||
const WSpace(16),
|
||||
@@ -95,10 +104,11 @@ class CollectionDetailScreen extends StatelessWidget {
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
const WSpace(2),
|
||||
AppTypography(
|
||||
0.toString(),
|
||||
type: Regular14px(),
|
||||
color: AppColors.disabled,
|
||||
StreamBuilder<List<Collection>>(
|
||||
stream: getIt<TicketsInterface>().watchTicketsList(),
|
||||
builder: (context, snapshot) {
|
||||
return _buildCount(snapshot.data?.length ?? 0);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -107,12 +117,20 @@ class CollectionDetailScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCount(int count) {
|
||||
return AppTypography(
|
||||
'$count',
|
||||
type: Regular14px(),
|
||||
color: AppColors.disabled,
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Название коллекции
|
||||
///
|
||||
Widget _buildCollectionTitle() {
|
||||
return AppTypography(
|
||||
'Астрономия и тайная комната Харли Хоттера',
|
||||
collection.title,
|
||||
type: Medium16px(),
|
||||
maxLines: 1,
|
||||
softWrap: true,
|
||||
@@ -127,9 +145,21 @@ class CollectionDetailScreen extends StatelessWidget {
|
||||
return SizedBox.square(
|
||||
dimension: 40.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(image: Assets.images.img.provider()),
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: AppColors.bg),
|
||||
|
||||
child: Wif(
|
||||
condition: collection.image != null,
|
||||
builder:
|
||||
(context) => ClipOval(
|
||||
child: Image.memory(collection.image!, fit: BoxFit.cover),
|
||||
),
|
||||
fallback:
|
||||
(context) => Center(
|
||||
child: AppTypography(
|
||||
collection.title.substring(0, 1),
|
||||
type: Bold34px(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user