-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Hi! According to our discussion here: #52
I anticipated that in this setup:
class CustomerPage extends StatefulWidget{
final GlobalKey mPortalScreenKey;
const CustomerPage({
super.key, required this.mPortalScreenKey
});
@override
State<CustomerPage> createState() => _CustomerPageState();
}
class _CustomerPageState extends State<CustomerPage> {
@override
Widget build(BuildContext context) {
// TODO: implement build
return Row(
children: [
Expanded(
child: Column(
children: [
Expanded(
child: ResizableContainer(
direction: Axis.horizontal,
/*
divider: ResizableDivider(
thickness: 5,
length: ResizableSize.ratio(0.75)
),*/
children: [
ResizableChild(
divider: ResizableDivider(thickness: 5, length: ResizableSize.ratio(0.75)),
child: MPortalMap(mPortalScreenKey: widget.mPortalScreenKey,),
size: const ResizableSize.ratio(0.5),
//minSize: 200
),
ResizableChild(
child: Center(
child: ResizableContainer(
direction: Axis.vertical,
children: [
ResizableChild(
divider: ResizableDivider(
thickness: 5,
length: ResizableSize.ratio(0.75)
),
child: CustomerInfoCard(),
//size: ResizableSize.shrink(),
size: ResizableSize.shrink(),
//minSize: 100
),
ResizableChild(
child: CustomerContactsCard(),
size:ResizableSize.expand()
)
],
),
),
//minSize: 500
)
]
),
),
],
),
),
],
);
}
}
the shrink() "parameter" for CustomerInfoCard above would shrink the ResizeableChild around the CustomerInfoCard and take its actual size into consideration, but it doesn't.
Am I missing something ?
CustomerInfoCard looks like this, the height of this Card might vary according to what happens inside and what data is presented.
class CustomerInfoCard extends StatelessWidget{
const CustomerInfoCard({super.key});
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(child: SingleChildScrollView(
child: StreamBuilder(
stream: globals.mPortalDatabase.getSelectedCustomer(SettingKey.userSelectionSelectedCustomer).watchSingleOrNull(),
builder: (context, snapshot) {
if(snapshot.hasError){
return Card(
color: Colors.red,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: Text(snapshot.error.toString(), style: TextStyle(color: Colors.yellow),),
),
);
}
if(snapshot.connectionState==ConnectionState.waiting){
return const LinearProgressIndicator();
}
if(snapshot.hasData){
var selectedCustomer = snapshot.data;
if(selectedCustomer!=null){
return Card(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(AppLocalizations.of(context).customerInfoCardCustomerInformation, style: TextStyle(fontWeight: FontWeight.bold),),
),
Divider(),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.custNo.toString()),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardCustomerNo)
),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.actNo.toString()),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardActorNo)
),
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.bsNo.toString()),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardBizNo)
),
),
),
),
],
),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.nm),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardCustomerName)
),
),
),
),
],
),
Row(
children: [
Expanded(
flex: 3,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: "${[null,""," "].contains(selectedCustomer.ad1)?"":selectedCustomer.ad1}"
"${((![null,""," "].contains(selectedCustomer.ad2))&&(![null,""," "].contains(selectedCustomer.ad1)))?"\n":""}"
"${[null,""," "].contains(selectedCustomer.ad2)?"":selectedCustomer.ad2}"),
readOnly: true,
maxLines: null,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardBillingAddress)
),
),
),
),
Expanded(
flex: 1,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.pNo),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardZIP)
),
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.pArea.toString()),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardPlace)
),
),
),
),
],
),
Row(
children: [
Expanded(
flex:2,
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.mailAd.toString()),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardMail)
),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.phone),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardPhone)
),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: TextEditingController(text: selectedCustomer.mobPh),
readOnly: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text(AppLocalizations.of(context).customerInfoCardAltPhone)
),
),
),
),
],
),
],
),
),
);
}
}
return Card(
color: Colors.amber,
child: Center(child: Padding(
padding: const EdgeInsets.all(4.0),
child: Text(AppLocalizations.of(context).customerInfoCardCustomerNotAvailable),
),),
);
}
),
))
],
);
}
}
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested