Fixed UI issue

This commit is contained in:
2026-08-24 18:38:46 +05:30
parent fc0faafa18
commit 71b2389221
58 changed files with 3521 additions and 53 deletions

View File

@@ -3,6 +3,8 @@ class Product {
final int? userId;
final int? categoryId;
final int? uomId;
final String? hsnCode;
final String name;
final String? sku;
final String? barcode;
@@ -33,6 +35,7 @@ class Product {
this.categoryId,
this.uomId,
required this.name,
this.hsnCode,
this.sku,
this.barcode,
this.description,
@@ -64,6 +67,7 @@ class Product {
categoryId: json['categoryId'] ?? json['category_id'],
uomId: json['uomId'] ?? json['uom_id'],
name: json['name'],
hsnCode: json['hsnCode'] ?? json['hsn_code'],
sku: json['sku'],
barcode: json['barcode'],
description: json['description'],
@@ -98,6 +102,7 @@ class Product {
'categoryId': categoryId,
'uomId': uomId,
'name': name,
'hsnCode': hsnCode,
'sku': sku,
'barcode': barcode,
'description': description,

View File

@@ -32,6 +32,7 @@ class _AddProductScreenState extends ConsumerState<AddProductScreen> {
// Basic
String _name = '';
String _sku = '';
String _hsnCode = '';
ProductCategory? _selectedCategory;
int? _uomId;
@@ -71,6 +72,7 @@ class _AddProductScreenState extends ConsumerState<AddProductScreen> {
final p = widget.product!;
_name = p.name;
_sku = p.sku ?? '';
_hsnCode = p.hsnCode ?? '';
_uomId = p.uomId;
_color = p.color ?? '';
_size = p.size ?? '';
@@ -269,6 +271,7 @@ class _AddProductScreenState extends ConsumerState<AddProductScreen> {
final product = Product(
id: widget.product?.id,
name: _name,
hsnCode: _hsnCode.isNotEmpty ? _hsnCode : null,
sku: _sku.isNotEmpty ? _sku : null,
categoryId: _selectedCategory?.id,
uomId: _uomId,
@@ -701,12 +704,26 @@ class _AddProductScreenState extends ConsumerState<AddProductScreen> {
const SizedBox(height: 20),
],
_buildPremiumTextField(
label: 'GST Rate (%)',
initialValue: _gstRate == 0 ? '' : _gstRate.toString(),
suffixText: '%',
keyboardType: const TextInputType.numberWithOptions(decimal: true),
onChanged: (val) => _gstRate = double.tryParse(val) ?? 0,
Row(
children: [
Expanded(
child: _buildPremiumTextField(
label: 'HSN Code',
initialValue: _hsnCode,
onChanged: (val) => _hsnCode = val,
),
),
const SizedBox(width: 16),
Expanded(
child: _buildPremiumTextField(
label: 'GST Rate (%)',
initialValue: _gstRate == 0 ? '' : _gstRate.toString(),
suffixText: '%',
keyboardType: const TextInputType.numberWithOptions(decimal: true),
onChanged: (val) => _gstRate = double.tryParse(val) ?? 0,
),
),
],
),
const SizedBox(height: 32),

View File

@@ -60,10 +60,22 @@ class _AdjustStockSheetState extends ConsumerState<AdjustStockSheet> {
@override
Widget build(BuildContext context) {
final inputDecoration = InputDecoration(
filled: true,
fillColor: Theme.of(context).brightness == Brightness.dark ? Colors.black26 : Colors.grey[100],
border: OutlineInputBorder(borderRadius: BorderRadius.circular(16), borderSide: BorderSide.none),
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(16), borderSide: BorderSide.none),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: Theme.of(context).colorScheme.primary, width: 2)
),
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
);
return Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom + 24,
@@ -86,10 +98,7 @@ class _AdjustStockSheetState extends ConsumerState<AdjustStockSheet> {
DropdownButtonFormField<String>(
value: _selectedType,
decoration: InputDecoration(
labelText: "Movement Type",
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
),
decoration: inputDecoration.copyWith(labelText: "Movement Type"),
items: _types.map((t) => DropdownMenuItem(value: t, child: Text(t))).toList(),
onChanged: (val) {
if (val != null) setState(() => _selectedType = val);
@@ -100,9 +109,8 @@ class _AdjustStockSheetState extends ConsumerState<AdjustStockSheet> {
TextFormField(
controller: _qtyController,
keyboardType: const TextInputType.numberWithOptions(decimal: true),
decoration: InputDecoration(
decoration: inputDecoration.copyWith(
labelText: "Quantity",
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
prefixIcon: const Icon(Icons.inventory_2),
),
),
@@ -110,9 +118,8 @@ class _AdjustStockSheetState extends ConsumerState<AdjustStockSheet> {
TextFormField(
controller: _notesController,
decoration: InputDecoration(
decoration: inputDecoration.copyWith(
labelText: "Notes (Optional)",
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
prefixIcon: const Icon(Icons.note),
),
),