aman-satu-flutter/lib/views/stocks/widget/stock_tile.dart

73 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:satu/core/utils/utils_parse.dart';
import 'package:satu/shared/app_colors.dart';
import 'package:satu/widgets/ui/product_title_widget.dart';
class StockTile extends StatefulWidget {
const StockTile({
required Key key,
required this.price,
required this.count,
this.name = '',
this.ean,
this.categoryName,
}) : super(key: key);
final String name;
final String? ean;
final String? categoryName;
final double price;
final double count;
@override
_StockTileState createState() =>
_StockTileState();
}
class _StockTileState
extends State<StockTile> {
@override
Widget build(BuildContext context) {
return ListTile(
key: widget.key!,
contentPadding:
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
title: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 4,
child: ProductTitleWidget(
name: widget.name,
ean: widget.ean,
categoryName: widget.categoryName,
),
),
Expanded(
flex: 2,
child: Text(
formatDecimal(widget.count),
style: const TextStyle(fontSize: 12, color: textColor),
overflow: TextOverflow.ellipsis,
)),
Expanded(
flex: 1,
child: Text(
formatDecimal(widget.price),
style: const TextStyle(fontSize: 12, color: textColor),
overflow: TextOverflow.ellipsis,
)),
],
),
tileColor: whiteColor,
);
}
}