我怎样才能让我的代码与这个架构一起工作?
How i can make my code working with this architecture?
我有一个问题,我不想做这个。
我已经得到了这个,但是我不能把卡片放在旁边,我试过 ListTile,或者只是一个文本,但我没有得到好的结果。
class Body extends StatelessWidget {
const Body({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Image(image: AssetImage(''),),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Avatar(
elevation: 5,
shadowColor: Colors.black,
sources: [
NetworkSource("",)
],
shape: AvatarShape.rectangle(100, 100, const BorderRadius.all(Radius.circular(20.0))),
),
Container (
height: 110.0,
child : Card (
color: const Color(0xFFD5EDE0),
elevation: 5,
shadowColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[
Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),
]
)
)
),
]
),
const Align(
alignment: Alignment(-0.8, 0.0),
child: Text("La séléction du mois", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
),
const SizedBox(height: 15),
Carouselslide(colors: const Color(0xFFD5EFF1), duree: const Duration(seconds: 7), list: list),
const SizedBox(height: 15,),
const Align(
alignment: Alignment(-0.8, 0.0),
child: Text("Les incontournables", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
),
const SizedBox(height: 15,),
Carouselslide(colors: const Color(0xFFEDD5EB), duree: const Duration(seconds: 5), list: list,),
const SizedBox(height: 15,),
const Align(
alignment: Alignment(-0.8, 0.0),
child: Text("Nouveaux produits", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
),
const SizedBox(height: 15,),
Carouselslide(colors: const Color(0xFFD5EDE0), duree: const Duration(seconds: 6), list: list,),
const SizedBox(height: 50,),
],
),
);
}
}
替换你的:
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[
Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),
]
)
与:
child: Padding(
padding: const EdgeInsets.all(10), // Padding will prevent your text touching the borders
child: Center( // Center widget centers vertically
child: Text(
"Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!",
textAlign: TextAlign.center, // Center horizontally
),
),
),
用扩展包:
Expanded(child:
Container (
height: 110.0,
child : Card (
color: const Color(0xFFD5EDE0),
elevation: 5,
shadowColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[
Expanded(child: Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),),
]
)
)
),),
我有一个问题,我不想做这个。
我已经得到了这个,但是我不能把卡片放在旁边,我试过 ListTile,或者只是一个文本,但我没有得到好的结果。
class Body extends StatelessWidget {
const Body({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Image(image: AssetImage(''),),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Avatar(
elevation: 5,
shadowColor: Colors.black,
sources: [
NetworkSource("",)
],
shape: AvatarShape.rectangle(100, 100, const BorderRadius.all(Radius.circular(20.0))),
),
Container (
height: 110.0,
child : Card (
color: const Color(0xFFD5EDE0),
elevation: 5,
shadowColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[
Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),
]
)
)
),
]
),
const Align(
alignment: Alignment(-0.8, 0.0),
child: Text("La séléction du mois", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
),
const SizedBox(height: 15),
Carouselslide(colors: const Color(0xFFD5EFF1), duree: const Duration(seconds: 7), list: list),
const SizedBox(height: 15,),
const Align(
alignment: Alignment(-0.8, 0.0),
child: Text("Les incontournables", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
),
const SizedBox(height: 15,),
Carouselslide(colors: const Color(0xFFEDD5EB), duree: const Duration(seconds: 5), list: list,),
const SizedBox(height: 15,),
const Align(
alignment: Alignment(-0.8, 0.0),
child: Text("Nouveaux produits", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
),
const SizedBox(height: 15,),
Carouselslide(colors: const Color(0xFFD5EDE0), duree: const Duration(seconds: 6), list: list,),
const SizedBox(height: 50,),
],
),
);
}
}
替换你的:
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[
Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),
]
)
与:
child: Padding(
padding: const EdgeInsets.all(10), // Padding will prevent your text touching the borders
child: Center( // Center widget centers vertically
child: Text(
"Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!",
textAlign: TextAlign.center, // Center horizontally
),
),
),
用扩展包:
Expanded(child:
Container (
height: 110.0,
child : Card (
color: const Color(0xFFD5EDE0),
elevation: 5,
shadowColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[
Expanded(child: Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),),
]
)
)
),),