fix(zipcode): cap table width in dialog to half screen via optional maxWidthCap; pass 0.5 fraction when used in Company/Warehouse dialogs
- ZipcodeTable: add maxWidthCap and use min(viewport, cap) to compute width - ZipcodeSearchScreen: allow tableMaxWidthFraction and forward to table - Apply 0.5 in CompanyForm and WarehouseLocationForm dialogs flutter analyze: 0 errors, warnings unaffected
This commit is contained in:
@@ -8,7 +8,10 @@ import 'package:superport/screens/zipcode/components/zipcode_table.dart';
|
||||
|
||||
class ZipcodeSearchScreen extends StatefulWidget {
|
||||
final Function(ZipcodeDto)? onSelect;
|
||||
const ZipcodeSearchScreen({super.key, this.onSelect});
|
||||
// When used in a dialog/popup, you can cap the table width
|
||||
// by setting this fraction (0.0–1.0) of the screen width.
|
||||
final double? tableMaxWidthFraction;
|
||||
const ZipcodeSearchScreen({super.key, this.onSelect, this.tableMaxWidthFraction});
|
||||
|
||||
@override
|
||||
State<ZipcodeSearchScreen> createState() => _ZipcodeSearchScreenState();
|
||||
@@ -236,6 +239,9 @@ class _ZipcodeSearchScreenState extends State<ZipcodeSearchScreen> {
|
||||
_showSuccessToast('우편번호 ${zipcode.zipcode}를 선택했습니다');
|
||||
}
|
||||
},
|
||||
maxWidthCap: widget.tableMaxWidthFraction != null
|
||||
? MediaQuery.sizeOf(context).width * widget.tableMaxWidthFraction!
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -248,4 +254,4 @@ class _ZipcodeSearchScreenState extends State<ZipcodeSearchScreen> {
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user