diff --git a/lib/feature/presentation/pages/order_detail_screen.dart b/lib/feature/presentation/pages/order_detail_screen.dart index 111fc5c..cd1d672 100644 --- a/lib/feature/presentation/pages/order_detail_screen.dart +++ b/lib/feature/presentation/pages/order_detail_screen.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_swipe_button/flutter_swipe_button.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:beFit_Del/feature/domain/entities/order_entity.dart'; import 'package:beFit_Del/feature/presentation/bloc/item_cubit/item_cubit.dart'; @@ -33,7 +34,7 @@ class _OrderDetailPageState extends State { context.read().getOrderItems(order.id); context.read().getPhoneLocation(order.address); context.read().getOrdersCost(isDelivered); - + var key = '1'; BitmapDescriptor address = BitmapDescriptor.defaultMarker; BitmapDescriptor home = BitmapDescriptor.defaultMarker; BitmapDescriptor.fromAssetImage( @@ -505,7 +506,7 @@ class _OrderDetailPageState extends State { bottomNavigationBar: Container( color: Color(0xFFFAF7F5), child: Padding( - padding: EdgeInsets.only(left: 20, right: 20, bottom: 20), + padding: EdgeInsets.only(left: 10, right: 10, bottom: 20), child: Container( color: Color(0xFFFAF7F5), height: 60, @@ -534,9 +535,19 @@ class _OrderDetailPageState extends State { ) : Align( alignment: Alignment.bottomLeft, - child: SwipeableButtonView( - buttonText: "Доставлен", - buttontextstyle: const TextStyle( + child: SwipeButton( + height: 60, + elevationThumb: 2, + activeTrackColor: const Color(0xFF78C4A4), + activeThumbColor: Colors.white, + thumbPadding: EdgeInsets.all(8.0), + thumb: const Icon( + Icons.arrow_forward_ios_rounded, + color: Colors.grey, + ), + child: const Text( + "Доставлен", + style: TextStyle( color: Colors.white, fontSize: 18, fontFamily: 'Nunito', @@ -544,40 +555,29 @@ class _OrderDetailPageState extends State { height: 0.07, letterSpacing: 0.09, ), - buttonWidget: Container( - child: const Icon( - Icons.arrow_forward_ios_rounded, - color: Colors.grey, - ), - ), - activeColor: const Color(0xFF78C4A4), - isFinished: isFinished, - onWaitingProcess: () { - Future.delayed(Duration(seconds: 2), () { - final double radius = 150; // Радиус в метрах - final distance = Geolocator.distanceBetween( - locationList[0], - locationList[1], - locationList[2], - locationList[3]); - if (distance <= radius) { - context - .read() - .setOrderIsDelivered(orderId, true); - } else { - isFinished = false; - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: - Text('Вы не в радиусе заказа!'), - backgroundColor: Colors.redAccent, - ), - ); - } - }); - }, - onFinish: () async {}), - ), + ), + onSwipe: () { + final double radius = 150; // Радиус в метрах + final distance = Geolocator.distanceBetween( + locationList[0], + locationList[1], + locationList[2], + locationList[3]); + if (distance <= radius) { + context + .read() + .setOrderIsDelivered(orderId, true); + } else { + isFinished = false; + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('Вы не в радиусе заказа!'), + backgroundColor: Colors.redAccent, + ), + ); + } + }, + )), BlocListener( listener: (context, state) { if (state is SetDeliveredLoaded) { diff --git a/pubspec.lock b/pubspec.lock index 71ce8fa..1173989 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -222,6 +222,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.17" + flutter_swipe_button: + dependency: "direct main" + description: + name: flutter_swipe_button + sha256: eaddf7bf536bf099f0bcf05bfa861a9ab5b7fb3e9fbfdf48c13180bdc2500ec9 + url: "https://pub.dev" + source: hosted + version: "2.1.1+1" flutter_test: dependency: "direct dev" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index b236829..7b56e7c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,7 @@ dependencies: fl_chart: ^0.67.0 url_launcher: ^6.2.5 swipeable_button_view: ^0.0.2 + flutter_swipe_button: ^2.1.1+1 dev_dependencies: flutter_test: