lab 5 final final done
This commit is contained in:
parent
65f3b68ff5
commit
0c18abafdf
25
lib/data/dtos/car_dto.g.dart
Normal file
25
lib/data/dtos/car_dto.g.dart
Normal file
@ -0,0 +1,25 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'car_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
CarDto _$CarDtoFromJson(Map<String, dynamic> json) => CarDto(
|
||||
count: (json['Count'] as num?)?.toInt(),
|
||||
message: json['Message'] as String?,
|
||||
searchCriteria: json['SearchCriteria'] as String?,
|
||||
results: (json['Results'] as List<dynamic>?)
|
||||
?.map(
|
||||
(e) => CarAttributesResultDto.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
CarAttributesResultDto _$CarAttributesResultDtoFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
CarAttributesResultDto(
|
||||
modelID: (json['Model_ID'] as num?)?.toInt(),
|
||||
makeName: json['Make_Name'] as String?,
|
||||
modelName: json['Model_Name'] as String?,
|
||||
);
|
@ -21,7 +21,10 @@ class CarRepository extends ApiInterface {
|
||||
const String url = '$_baseUrl/GetModelsForMakeYear/make/honda/modelyear/1990?format=json';
|
||||
const String searchurl = '$_baseUrl/GetModelsForMakeYear/make/[name_count]/modelyear/1990?format=json';
|
||||
|
||||
final String finalUrl = q != null ? searchurl.replaceFirst('[name_count]', q) : url;
|
||||
final String finalUrl = q != null && q.trim().isNotEmpty
|
||||
? searchurl.replaceFirst('[name_count]', q.trim())
|
||||
: url;
|
||||
|
||||
final Response<dynamic> response = await _dio.get<Map<dynamic, dynamic>>(finalUrl);
|
||||
|
||||
print('Response data: ${response.data}');
|
||||
|
@ -1,4 +1,5 @@
|
||||
part of 'home_page.dart';
|
||||
|
||||
// Ctrl+Alt+L
|
||||
typedef OnLikeCallback = void Function(String title, bool isLike)?;
|
||||
|
||||
@ -66,7 +67,7 @@ class _CarState extends State<_Car> {
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: SizedBox(
|
||||
height: 150,
|
||||
height: 160,
|
||||
width: 150,
|
||||
child: Image.network(
|
||||
widget.imageUrl ?? '',
|
||||
@ -83,12 +84,47 @@ class _CarState extends State<_Car> {
|
||||
children: [
|
||||
Text(
|
||||
widget.text,
|
||||
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
style: const TextStyle(
|
||||
fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
widget.descriptionCar,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.normal),
|
||||
)
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.normal),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// Отступ между текстом и виджетом со скидкой
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.orangeAccent,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.fromLTRB(8, 2, 8, 2),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.account_balance_wallet,
|
||||
// Иконка со скидкой
|
||||
color: Colors.black,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
// Пробел между иконкой и текстом
|
||||
Text(
|
||||
'Exclusive!',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium
|
||||
?.copyWith(color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -7,7 +7,7 @@ import 'package:mylab/presentation/details_page/details_page.dart';
|
||||
import 'package:mylab/presentation/dialogs/show_dialog.dart';
|
||||
|
||||
part 'car.dart';
|
||||
// showErrorDialog
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({super.key, required this.title});
|
||||
|
||||
@ -53,6 +53,7 @@ class _BodyState extends State<Body> {
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: CupertinoSearchTextField(
|
||||
controller: searchController,
|
||||
placeholder: 'марка',
|
||||
onChanged: (search) {
|
||||
setState(() {
|
||||
data = repo.loadData(q: search);
|
||||
|
Loading…
x
Reference in New Issue
Block a user