You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
4.0 KiB
Dart
113 lines
4.0 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../../../controllers/localization/localization.dart';
|
|
import '../../../controllers/providers/api/user_provider.dart';
|
|
import '../../../models/gas_refill/gas_refill_model.dart';
|
|
import '../../../models/subtitle.dart';
|
|
import '../../../models/user.dart';
|
|
import '../../app_style/colors.dart';
|
|
import '../../app_style/sizing.dart';
|
|
import '../requests/request_status.dart';
|
|
class GasRefillItem extends StatelessWidget {
|
|
final int index;
|
|
final GasRefillModel item;
|
|
final Function(GasRefillModel)? onPressed;
|
|
const GasRefillItem({Key? key, required this.item, this.onPressed, required this.index}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Subtitle? _subtitle = AppLocalization.of(context)?.subtitle;
|
|
User? _user = Provider.of<UserProvider>(context,listen: false).user;
|
|
Color itemColor = index % 2 == 0
|
|
? Theme.of(context).colorScheme.primary
|
|
: Theme.of(context).colorScheme.onPrimary;
|
|
Color onItemColor = index % 2 != 0
|
|
? Theme.of(context).colorScheme.primary
|
|
: Theme.of(context).colorScheme.onPrimary;
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
|
child: ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
padding: EdgeInsets.symmetric(vertical: 8,horizontal: 8),
|
|
backgroundColor: itemColor,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(
|
|
AppStyle.getBorderRadius(context)
|
|
),
|
|
),
|
|
),
|
|
//padding: EdgeInsets.symmetric(vertical: 8,horizontal: 8),
|
|
onPressed: (){
|
|
onPressed!(item);
|
|
},
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
item.title ?? "-----",
|
|
style: Theme.of(context).textTheme.headline6?.copyWith(
|
|
color: onItemColor,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.bold
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
_subtitle?.hospital??"",
|
|
style: Theme.of(context).textTheme.subtitle2?.copyWith(
|
|
color: onItemColor,
|
|
),
|
|
),
|
|
),
|
|
Text(
|
|
item.clientName??"",
|
|
style: Theme.of(context).textTheme.subtitle2?.copyWith(
|
|
color: onItemColor,
|
|
),
|
|
),
|
|
|
|
],
|
|
),
|
|
Divider(color: onItemColor,),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
_subtitle?.status??"",
|
|
style: Theme.of(context).textTheme.subtitle2?.copyWith(
|
|
color: onItemColor,
|
|
),
|
|
),
|
|
),
|
|
StatusLabel(label: item.status?.label??"",
|
|
color: AColors.getGasStatusColor(item.status?.id??0)
|
|
),
|
|
],
|
|
),
|
|
//Divider(color: onItemColor,),
|
|
|
|
],
|
|
),
|
|
),
|
|
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|