Добавлен вывод деталки коллекции
This commit is contained in:
@@ -13,6 +13,7 @@ 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/collections_screen.dart';
|
||||
import 'package:remever/screens/collections/widgets/ticket_card.dart';
|
||||
import 'package:remever/screens/dialogs/info_dialog.dart';
|
||||
import 'package:remever/services/tickets/tickets_interface.dart';
|
||||
@@ -50,7 +51,6 @@ class CollectionDetailScreen extends StatelessWidget {
|
||||
shadowColor: Colors.transparent,
|
||||
leading: IconButton(
|
||||
onPressed: () async {
|
||||
// context.read<HomeCubit>().toCollection();
|
||||
context.back();
|
||||
},
|
||||
icon: const Icon(CupertinoIcons.left_chevron, color: Colors.black),
|
||||
@@ -172,7 +172,34 @@ class CollectionDetailScreen extends StatelessWidget {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16).r,
|
||||
|
||||
child: _buildList(context),
|
||||
child: StreamBuilder<List<Ticket>>(
|
||||
stream: getIt<TicketsInterface>().watchTicketsList(collection.id),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const LoadingList();
|
||||
}
|
||||
|
||||
if (snapshot.hasError) {
|
||||
return const ErrorList();
|
||||
}
|
||||
|
||||
final tickets = snapshot.data;
|
||||
if (tickets == null || tickets.isEmpty) {
|
||||
return _buildEmptyList(context);
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: tickets.length,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemBuilder:
|
||||
(context, index) => TicketCard(
|
||||
currentCollection: collection,
|
||||
ticket: tickets[index],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
// child: _buildList(context),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,16 +228,4 @@ class CollectionDetailScreen extends StatelessWidget {
|
||||
child: AppTypography('Создать карточку', type: Regular14px()),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение списка карточек
|
||||
///
|
||||
Widget _buildList(BuildContext context) {
|
||||
return ListView.builder(
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemCount: 10,
|
||||
itemBuilder:
|
||||
(BuildContext context, int index) => TicketCard(index: index),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user