mnemo_cards/lib/widgets/card_game/card_game_swipe_helper.dart

69 lines
2.1 KiB
Dart
Raw Normal View History

2024-05-22 20:48:44 +00:00
import 'package:flutter/material.dart';
import '../../features/card_swiper/src/card_swiper_controller.dart';
class CardGameSwipeHelper extends StatelessWidget {
final CardSwiperController cardSwiperController;
const CardGameSwipeHelper(this.cardSwiperController);
@override
Widget build(BuildContext context) {
final theme = Theme.of(context).textTheme;
return Container(
padding: const EdgeInsets.only(
left: 16.0,
right: 16.0,
bottom: 0.0,
),
child: StreamBuilder(
stream: cardSwiperController.asStream,
builder: (context, snapshot) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(
Icons.circle,
color: Colors.green,
),
SizedBox(
width: 4.0,
),
Text(
'Помню ${cardSwiperController.swipedLeftIds.isEmpty ? '' : cardSwiperController.swipedLeftIds.length}',
style: theme.labelMedium?.copyWith(
color: Colors.green,
fontWeight: FontWeight.w600,
),
)
],
),
Row(
children: [
Text(
'Повторить ${cardSwiperController.swipedRightIds.isEmpty ? '' : cardSwiperController.swipedRightIds.length}',
style: theme.labelMedium?.copyWith(
color: Colors.yellow[600],
fontWeight: FontWeight.w600,
),
),
SizedBox(
width: 4.0,
),
Icon(
Icons.circle,
color: Colors.yellow[600],
),
],
),
],
);
}
),
);
}
}