Skip to content

Commit

Permalink
update project
Browse files Browse the repository at this point in the history
  • Loading branch information
a4ifka committed Apr 19, 2024
1 parent de6056c commit ede8fb6
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 46 deletions.
6 changes: 3 additions & 3 deletions lib/feature/data/models/order_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class OrderModel extends OrderEntity {
required super.clientPhone,
required super.clientName,
required super.orderDate,
required super.neadToCall,
});

factory OrderModel.fromJson(Map<String, dynamic> map) {
Expand All @@ -20,6 +21,7 @@ class OrderModel extends OrderEntity {
clientPhone: map['client_phone'] as String,
clientName: map['client_name'] as String,
orderDate: DateTime.parse(map['order_date'] as String),
neadToCall: map['nead_to_call'] as bool,
);
}

Expand All @@ -32,9 +34,7 @@ class OrderModel extends OrderEntity {
'clientPhone': clientPhone,
'clientName': clientName,
'orderDate': orderDate.toIso8601String(),
'neadToCall': neadToCall,
};
}



}
34 changes: 22 additions & 12 deletions lib/feature/domain/entities/order_entity.dart
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
import 'package:equatable/equatable.dart';

class OrderEntity extends Equatable{
class OrderEntity extends Equatable {
final int id;
final String orderNumber;
final String address;
final bool isDelivered;
final String clientPhone;
final String clientName;
final DateTime orderDate;

const OrderEntity({
required this.id,
required this.orderNumber,
required this.address,
required this.isDelivered,
required this.clientPhone,
required this.clientName,
required this.orderDate,
});
final bool neadToCall;

const OrderEntity(
{required this.id,
required this.orderNumber,
required this.address,
required this.isDelivered,
required this.clientPhone,
required this.clientName,
required this.orderDate,
required this.neadToCall});

@override
get props => [id, orderNumber, address, isDelivered, clientPhone, clientName, orderDate];
get props => [
id,
orderNumber,
address,
isDelivered,
clientPhone,
clientName,
orderDate,
neadToCall
];
}
75 changes: 48 additions & 27 deletions lib/feature/presentation/pages/order_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,35 +357,56 @@ class _OrderDetailPageState extends State<OrderDetailPage> {
}
},
),
Align(
alignment: Alignment.bottomLeft,
child: SwipeableButtonView(
buttonText: "Доставлен",
buttontextstyle: const TextStyle(
color: Colors.white,
fontSize: 18,
fontFamily: 'Nunito',
fontWeight: FontWeight.w600,
height: 0.07,
letterSpacing: 0.09,
),
buttonWidget: Container(
child: const Icon(
Icons.arrow_forward_ios_rounded,
color: Colors.grey,
isDelivered
? ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(60),
foregroundColor: Colors.black,
backgroundColor: Colors.black,
surfaceTintColor: Colors.black,
),
onPressed: () {},
child: const Text(
'Заказ доставлен',
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontFamily: 'Nunito',
fontWeight: FontWeight.w600,
height: 0.07,
letterSpacing: 0.09,
),
),
)
: Align(
alignment: Alignment.bottomLeft,
child: SwipeableButtonView(
buttonText: "Доставлен",
buttontextstyle: const TextStyle(
color: Colors.white,
fontSize: 18,
fontFamily: 'Nunito',
fontWeight: FontWeight.w600,
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), () {
context
.read<SetDeliveredCubit>()
.setOrderIsDelivered(orderId, true);
});
},
onFinish: () async {}),
),
activeColor: const Color(0xFF78C4A4),
isFinished: isFinished,
onWaitingProcess: () {
Future.delayed(Duration(seconds: 2), () {
context
.read<SetDeliveredCubit>()
.setOrderIsDelivered(orderId, true);
});
},
onFinish: () async {}),
),
BlocListener<SetDeliveredCubit, SetDeliveredState>(
listener: (context, state) {
if (state is SetDeliveredLoaded) {
Expand Down
6 changes: 3 additions & 3 deletions lib/feature/presentation/pages/order_screen.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:iiko_delivery/feature/presentation/bloc/daily_salary_cubit/daily_salary_cubit.dart';
import 'package:iiko_delivery/feature/presentation/bloc/orders_cost_cubit/orders_cost_cubit.dart';
import 'package:iiko_delivery/feature/presentation/bloc/sign_out_cubit/sign_out_cubit.dart';
import 'package:intl/intl.dart';
import 'package:iiko_delivery/feature/presentation/bloc/order_cubit/order_cubit.dart';
import 'package:iiko_delivery/feature/presentation/bloc/order_cubit/order_state.dart';
Expand Down Expand Up @@ -39,7 +39,7 @@ class _HomePageState extends State<HomePage> {
schema: 'public',
table: 'Orders',
callback: (payload) {
context.read<SignOutUserCubit>().signOutUser();
context.read<OrderCubit>().getUserOrders(isDelivered, today);
print('callback');
})
.subscribe();
Expand All @@ -59,7 +59,7 @@ class _HomePageState extends State<HomePage> {
),
leading: IconButton(
onPressed: () {
context.read<OrdersCostCubit>().getOrdersCost(isDelivered);
SystemNavigator.pop();
},
icon: const Icon(Icons.exit_to_app_outlined)),
backgroundColor: const Color(0xFFFAF7F5),
Expand Down
15 changes: 14 additions & 1 deletion lib/feature/presentation/widgets/order_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class OrderListItem extends StatefulWidget {

class _OrderListItemState extends State<OrderListItem> {
var expand = false;

@override
Widget build(BuildContext context) {
return GestureDetector(
Expand Down Expand Up @@ -121,6 +120,20 @@ class _OrderListItemState extends State<OrderListItem> {
const SizedBox.square(
dimension: 5,
),
Align(
alignment: Alignment.topLeft,
child: widget.orderModel.neadToCall
? const Text(
'Звонить за 15 минут',
style: TextStyle(
color: Colors.black,
fontSize: 18,
fontFamily: 'Nunito',
fontWeight: FontWeight.w500,
height: 0,
),
)
: null),
Align(
alignment: Alignment.bottomRight,
child: Text(
Expand Down

0 comments on commit ede8fb6

Please sign in to comment.