I have the following layout
Form(
onChanged: _updateFormProgress,
child: Row(
children: [
Expanded(
flex: 3,
child: Column(
children: [
....
],
),
),
Expanded(
flex: 2,
child: Column(
children: [
...
],
),
)
],
),
);
I need a vertical separator line beteen the two Expanded
I tried:
Form(
onChanged: _updateFormProgress,
child: Row(
children: [
Expanded(
flex: 3,
child: Column(
children: [
....
],
),
),
Container(
child: VerticalDivider(
color: Colors.red,
width: 1,
)
),
Expanded(
flex: 2,
child: Column(
children: [
...
],
),
)
],
),
);
And it compiles but I can't see the line. I also tried other options like wrapping the Expanded in a Container and make a border but have different issues with that
I changed code like tree you provide, and change it to work.
Please wrap 'Row' with 'IntrinsicHeight'.
I attached full code I tested.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Padding(
padding: EdgeInsets.all(10),
child: Center(
child: Column(
children: [
Container(
child: Form(
onChanged: () {},
child: IntrinsicHeight(
child: Row(
children: [
Expanded(
flex: 3,
child: Column(
children: [
Container(child: Text('a')),
Container(child: Text('a')),
Container(child: Text('a')),
],
),
),
Container(
child: VerticalDivider(
color: Colors.red,
width: 1,
),
),
Expanded(
flex: 2,
child: Column(
children: [
Container(child: Text('a')),
Container(child: Text('a')),
Container(child: Text('a')),
],
),
)
],
),
),
),
),
],
),
),
),
);
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments