developed

This commit is contained in:
komekh 2024-08-27 09:53:55 +05:00
parent 6ed76123f7
commit 129a021ed9
8 changed files with 89 additions and 61 deletions

View File

@ -20,7 +20,7 @@
"login_hint": "Öz loginiňizi ýazyň",
"password": "Açar sözi",
"password_hint": "Öz açar sözüni ýazyň",
"credentials_validation_header": "'Invalid credentials",
"credentials_validation_header": "Invalid credentials",
"credentials_validation_body": "Username or Password Wrong!",
"required_validation": "This field can't be empty",
"order": "Sargyt",
@ -43,5 +43,8 @@
"order_details": "Giňişleýin",
"order_from_card": "Nireden",
"order_to_card": "Nirä",
"order_sent": "Ugradylan senesi"
"order_sent": "Ugradylan senesi",
"Reserved": "Rezerw",
"Received": "Kabul edildi",
"Delivered": "Gowşuryldy"
}

View File

@ -43,5 +43,8 @@
"order_details": "Giňişleýin",
"order_from_card": "Nireden",
"order_to_card": "Nirä",
"order_sent": "Ugradylan senesi"
"order_sent": "Ugradylan senesi",
"Reserved":"Rezerw",
"Received":"Kabul edildi",
"Delivered":"Gowşuryldy"
}

View File

@ -1,3 +1,4 @@
const String baseUrl = 'https://192.168.99.64:5001/api';
// const String baseUrl = 'https://192.168.99.64:5001/api';
const String baseUrl = 'https://cargo.tpsadvertising.com/api';
const String defaultApiKey = '';
const String defaultSources = '';

View File

@ -37,9 +37,9 @@ class OrderRemoteDataSourceImpl implements OrderRemoteDataSource {
}
@override
Future<RouteResponseModel> getRoutes(String orderId) async {
Future<RouteResponseModel> getRoutes(String cargoId) async {
final response = await client.get(
Uri.parse('$baseUrl/Cargo/Route/$orderId'),
Uri.parse('$baseUrl/Cargo/Route/$cargoId'),
headers: {
'Content-Type': 'application/json',
'accept': '*/*',

View File

@ -21,6 +21,9 @@ class OrderModel extends OrderEntity {
required super.depth,
required super.width,
required super.height,
required super.image1,
required super.image2,
required super.image3,
});
// Factory method to create an instance of CargoEntity from JSON
factory OrderModel.fromJson(Map<String, dynamic> json) {
@ -31,42 +34,45 @@ class OrderModel extends OrderEntity {
clientId: json['ClientId'],
cargoId: json['CargoId'],
state: json['State'],
no: json['No'],
name: json['Name'],
shopNo: json['ShopNo'],
no: json['No'] ?? '',
name: json['Name'] ?? '',
shopNo: json['ShopNo'] ?? '',
volume: json['Volume'].toDouble(),
placesCount: json['PlacesCount'],
carrier: json['Carrier'],
from: json['From'],
to: json['To'],
carrier: json['Carrier'] ?? '',
from: json['From'] ?? '',
to: json['To'] ?? '',
departedAt: DateUtil.formatDateTimeToDDMMYYYY(departedAt),
arrivedAt: DateUtil.formatDateTimeToDDMMYYYY(arrivedAt),
depth: json['Depth'].toDouble(),
width: json['Width'].toDouble(),
height: json['Height'].toDouble(),
image1: json['Image1'] ?? '',
image2: json['Image2'] ?? '',
image3: json['Image3'] ?? '',
);
}
// Method to convert CargoEntity to JSON
Map<String, dynamic> toJson() {
return {
'Oid': oid,
'ClientId': clientId,
'CargoId': cargoId,
'State': state,
'No': no,
'Name': name,
'ShopNo': shopNo,
'Volume': volume,
'PlacesCount': placesCount,
'Carrier': carrier,
'From': from,
'To': to,
'DepartedAt': departedAt,
'ArrivedAt': arrivedAt,
'Depth': depth,
'Width': width,
'Height': height,
};
}
// Map<String, dynamic> toJson() {
// return {
// 'Oid': oid,
// 'ClientId': clientId,
// 'CargoId': cargoId,
// 'State': state,
// 'No': no,
// 'Name': name,
// 'ShopNo': shopNo,
// 'Volume': volume,
// 'PlacesCount': placesCount,
// 'Carrier': carrier,
// 'From': from,
// 'To': to,
// 'DepartedAt': departedAt,
// 'ArrivedAt': arrivedAt,
// 'Depth': depth,
// 'Width': width,
// 'Height': height,
// };
// }
}

View File

@ -18,6 +18,9 @@ class OrderEntity extends Equatable {
final double depth;
final double width;
final double height;
final String image1;
final String image2;
final String image3;
const OrderEntity({
required this.oid,
@ -37,6 +40,9 @@ class OrderEntity extends Equatable {
required this.depth,
required this.width,
required this.height,
required this.image1,
required this.image2,
required this.image3,
});
@override

View File

@ -21,13 +21,22 @@ class OrderDetailsScreen extends StatefulWidget {
class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
bool _isFullScreen = false; // Track fullscreen mode
bool _showLocation = true;
@override
void initState() {
context.read<OrderDetailBloc>().add(GetRoutes(widget.order.cargoId));
_checkLocationStatus();
super.initState();
}
void _checkLocationStatus() {
setState(() {
debugPrint('NAME: ${GoodsState.Reserved.name}');
_showLocation = widget.order.state != GoodsState.Reserved.name;
});
}
void _toggleFullScreen() {
setState(() {
_isFullScreen = !_isFullScreen;
@ -62,6 +71,7 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
body: CustomScrollView(
slivers: [
/// map
if (_showLocation)
SliverToBoxAdapter(
child: SizedBox(
height: _isFullScreen
@ -98,6 +108,7 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
),
/// current location info
if (_showLocation)
SliverToBoxAdapter(
child: Padding(
padding: Space.all(1, 1),

View File

@ -90,7 +90,7 @@ class OrderCard extends StatelessWidget {
width: AppDimensions.normalize(1),
height: AppDimensions.normalize(2.5),
topColor: AppColors.green,
bottomColor: AppColors.grey,
bottomColor: order.state == GoodsState.Delivered.name ? AppColors.green : AppColors.grey,
),
),
@ -133,8 +133,6 @@ class OrderCard extends StatelessWidget {
),
],
),
/* */
),
// const Spacer(flex: 1),
Expanded(