sync changes
This commit is contained in:
@@ -30,7 +30,6 @@ class TariffSheet extends StatefulWidget {
|
||||
|
||||
class _TariffSheetState extends State<TariffSheet> {
|
||||
int? _selectedTariffIndex;
|
||||
bool _hasPaymentCard = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -40,7 +39,27 @@ class _TariffSheetState extends State<TariffSheet> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<TariffSheetBloc, TariffSheetState>(
|
||||
return BlocConsumer<TariffSheetBloc, TariffSheetState>(
|
||||
listener: (context, state) {
|
||||
if (state.status == TariffSheetStatus.failure && state.errorMessage != null) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
state.errorMessage!,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
backgroundColor: Colors.redAccent.withOpacity(0.9),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
margin: const EdgeInsets.all(20),
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state.status == TariffSheetStatus.loading) {
|
||||
return Align(
|
||||
@@ -193,7 +212,7 @@ class _TariffSheetState extends State<TariffSheet> {
|
||||
bottom: 0,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${widget.scooter.batteryLevel.toInt()}%', // ✅ Цифры
|
||||
'${widget.scooter.batteryLevel.toInt()}%',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
@@ -245,6 +264,7 @@ class _TariffSheetState extends State<TariffSheet> {
|
||||
'Минута на паузе ${tariff.pausePrice.toStringAsFixed(0)} ${tariff.currency}',
|
||||
],
|
||||
isSelected: _selectedTariffIndex == index,
|
||||
isInsurance: state.isInsurance,
|
||||
tariff: tariff,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
@@ -380,7 +400,7 @@ class _TariffSheetState extends State<TariffSheet> {
|
||||
0,
|
||||
state.useBalance ? null : state.selectedCard?.id,
|
||||
state.useBalance,
|
||||
false
|
||||
state.isInsurance
|
||||
)
|
||||
);
|
||||
context.pushReplacement('/home/current-rides-sheet');
|
||||
@@ -421,6 +441,7 @@ class _TariffCard extends StatelessWidget {
|
||||
final String currency;
|
||||
final String subtitle;
|
||||
final List<String> details;
|
||||
final bool isInsurance;
|
||||
final bool isSelected;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@@ -432,6 +453,7 @@ class _TariffCard extends StatelessWidget {
|
||||
required this.subtitle,
|
||||
required this.details,
|
||||
required this.isSelected,
|
||||
required this.isInsurance,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@@ -448,14 +470,11 @@ class _TariffCard extends StatelessWidget {
|
||||
: Colors.white.withOpacity(0.19),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
// Используем Stack, чтобы наложить кнопку поверх контента
|
||||
child: Stack(
|
||||
children: [
|
||||
// Основной контент карточки
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Заголовок с иконкой часов
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
@@ -531,8 +550,16 @@ class _TariffCard extends StatelessWidget {
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) => TariffInfoSheet(tariff: tariff),
|
||||
builder: (context) => TariffInfoSheet(
|
||||
tariff: tariff,
|
||||
isInsurance: isInsurance,
|
||||
onChanged: (val) {
|
||||
context.read<TariffSheetBloc>().add(InsuranceToggled(val));
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
|
||||
print('Info pressed for $title');
|
||||
},
|
||||
child: Image.asset(
|
||||
|
||||
Reference in New Issue
Block a user