नीचे के रूप में मैं एक TextFormFiled जोड़ने का प्रयास करता हूं और इसे त्रुटि जोड़ने के बाद एक रेंडरफ्लेक्स ओवरफ्लो होता है:
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Text('Rate the order !', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),),
SizedBox(height: 10,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(starCount, (index)=>buildStar(context, index)),
),
Padding(
padding: EdgeInsets.all(10),
child: Form(child:TextFormField(
decoration: (InputDecoration(
labelText: 'add your notes'
)),
textInputAction: TextInputAction.done,
)),
)
],
);
0
Ahmad Mohy
4 मई 2020, 03:05
4 जवाब
सबसे बढ़िया उत्तर
कॉलम को SingleChildScrollView में लपेटें।
डार्टपैड पर काम करने का नमूना: https://dartpad.dev/b6409e10de32b280b8938aa75364fa7b
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
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> {
Widget build(BuildContext context) {
return Material(child:
SingleChildScrollView(child:
Column(
children: <Widget>[
Text('Rate the order !', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),),
SizedBox(height: 10,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(10, (index)=>Icon(Icons.star)),
),
SizedBox(height: 10,),
Column(
mainAxisAlignment: MainAxisAlignment.center,
// add many children just to overflow on the bottom
children: List.generate(100, (index)=>Icon(Icons.video_call)),
),
Padding(
padding: EdgeInsets.all(10),
child: Form(child:TextFormField(
decoration: (InputDecoration(
labelText: 'add your notes'
)),
textInputAction: TextInputAction.done,
)),
)
],
),),);
}
}
0
camillo777
4 मई 2020, 15:33
Column
को SingleChildScrollView
के child
के रूप में रखें
0
Xihuny
4 मई 2020, 03:08
यह पूरी तरह से काम किया, इसे देखें। नीचे कोड देखें:
import 'package:flutter/material.dart';
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Text('Rate the order !', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),),
SizedBox(height: 10,),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(starCount, (index)=>buildStar(context, index)),
),
),
Padding(
padding: EdgeInsets.all(10),
child: Form(child:TextFormField(
decoration: (InputDecoration(
labelText: 'add your notes'
)),
textInputAction: TextInputAction.done,
)),
)
],
);
मुझे उम्मीद है यह मदद करेगा।
0
void
4 मई 2020, 03:26
पंक्ति के अंदर कॉलम या अपनी सूची को एक निश्चित ऊंचाई दें। कंटेनर या किसी अन्य विजेट का उपयोग करें
0
Mohammad_Asef
4 मई 2020, 14:27
संबंधित सवाल
नए सवाल
flutter
स्पंदन Google द्वारा बनाई गई एक ओपन-सोर्स UI सॉफ़्टवेयर डेवलपमेंट किट है। इसका उपयोग Android, iOS, Linux, Mac, Windows, Google Fuchsia और वेब के लिए एक ही कोडबेस से एप्लिकेशन विकसित करने के लिए किया जाता है। स्पंदन ऐप्स डार्ट भाषा में लिखे गए हैं।
mainAxisSize: MainAxisSize.min
सेट किया है?