177 lines
6.9 KiB
Dart
177 lines
6.9 KiB
Dart
import 'dart:ui';
|
||
import 'package:be_happy/domain/entities/tariff.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter/cupertino.dart';
|
||
|
||
class TariffInfoSheet extends StatefulWidget {
|
||
final Tariff tariff;
|
||
|
||
const TariffInfoSheet({super.key, required this.tariff});
|
||
|
||
@override
|
||
State<TariffInfoSheet> createState() => _TariffInfoSheetState();
|
||
}
|
||
|
||
class _TariffInfoSheetState extends State<TariffInfoSheet> {
|
||
bool _isInsuranceEnabled = true;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return DraggableScrollableSheet(
|
||
initialChildSize: 0.6,
|
||
minChildSize: 0.4,
|
||
maxChildSize: 0.9,
|
||
expand: false,
|
||
builder: (context, scrollController) {
|
||
return ClipRRect(
|
||
borderRadius: const BorderRadius.vertical(top: Radius.circular(30)),
|
||
child: BackdropFilter(
|
||
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
color: const Color(0xFF000032).withOpacity(0.9),
|
||
borderRadius: const BorderRadius.vertical(top: Radius.circular(30)),
|
||
),
|
||
child: Column(
|
||
children: [
|
||
// Полоска сверху (Handle)
|
||
const SizedBox(height: 12),
|
||
Container(
|
||
width: 40,
|
||
height: 4,
|
||
decoration: BoxDecoration(
|
||
color: Colors.white.withOpacity(0.3),
|
||
borderRadius: BorderRadius.circular(2),
|
||
),
|
||
),
|
||
const SizedBox(height: 12),
|
||
|
||
// Контент со скроллом
|
||
Expanded(
|
||
child: ListView(
|
||
controller: scrollController,
|
||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||
children: [
|
||
// Заголовок
|
||
Center(
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
const Icon(Icons.timer_outlined, color: Color(0xFF66E3C4), size: 18),
|
||
const SizedBox(width: 8),
|
||
Text(
|
||
widget.tariff.title,
|
||
style: const TextStyle(
|
||
color: Color(0xFF66E3C4),
|
||
fontSize: 18,
|
||
fontWeight: FontWeight.bold,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 30),
|
||
|
||
// Таблица цен
|
||
_buildPriceRow('Старт поездки', '${widget.tariff.startPrice} BYN'),
|
||
_buildPriceRow('Последующая минута', '${widget.tariff.drivePrice} BYN'),
|
||
_buildPriceRow('Пауза', '${widget.tariff.pausePrice} BYN/мин'),
|
||
_buildPriceRow('КЕШБЭК', '${widget.tariff.cashback * 100}%', isAccent: true),
|
||
|
||
const Divider(color: Colors.white24, height: 40),
|
||
|
||
// Страховка
|
||
Row(
|
||
children: [
|
||
const Text(
|
||
'Страховка',
|
||
style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600),
|
||
),
|
||
const SizedBox(width: 8),
|
||
Image.asset('assets/icons/info_icon.png', width: 18, height: 18),
|
||
const Spacer(),
|
||
Text(
|
||
'${widget.tariff.insurance} BYN',
|
||
style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
|
||
),
|
||
const SizedBox(width: 12),
|
||
Transform.scale(
|
||
scale: 0.8,
|
||
child: CupertinoSwitch(
|
||
value: _isInsuranceEnabled,
|
||
activeColor: const Color(0xFF66E3C4),
|
||
onChanged: (val) => setState(() => _isInsuranceEnabled = val),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
|
||
const Divider(color: Colors.white24, height: 40),
|
||
|
||
// Список правил (Bullet points)
|
||
_buildInfoBullet('Оплата страховки осуществляется только по банковской карте отдельным платежом'),
|
||
_buildInfoBullet('В режиме паузы время тарифа приостанавливается'),
|
||
_buildInfoBullet('При старте заказа будет заблокирована сумма в размере 7 рублей для проверки платежеспособности. Сумма разблокируется по факту списания средств за поездку.'),
|
||
|
||
const SizedBox(height: 30),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
|
||
Widget _buildPriceRow(String label, String value, {bool isAccent = false}) {
|
||
return Padding(
|
||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||
child: Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
Text(
|
||
label,
|
||
style: TextStyle(color: Colors.white.withOpacity(0.8), fontSize: 15),
|
||
),
|
||
Text(
|
||
value,
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 18,
|
||
fontWeight: isAccent ? FontWeight.bold : FontWeight.w500,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
|
||
Widget _buildInfoBullet(String text) {
|
||
return Padding(
|
||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||
child: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
const Padding(
|
||
padding: EdgeInsets.only(top: 6),
|
||
child: Icon(Icons.circle, size: 4, color: Colors.white),
|
||
),
|
||
const SizedBox(width: 12),
|
||
Expanded(
|
||
child: Text(
|
||
text,
|
||
style: TextStyle(
|
||
color: Colors.white.withOpacity(0.9),
|
||
fontSize: 13,
|
||
height: 1.5,
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
} |