颤动不应用填充
flutter not appling padding
Row(
children: [
Padding(
padding: const EdgeInsets.only(left:15),
child: CircleAvatar(
radius: 30.0,
backgroundImage:NetworkImage('https://lh3.googleusercontent.com/fife/AAWUweVJ6fa0mu8MKDVxZb4AyDAY26PRa78SPnSUIJlo9fB6gnwWgQI-ARzrhqg2Z7X82PGJ_3VhJF385aL85wlg83NShyZcM_D-PdfabWVsu_q8nH4M9fWHp2KEolKaiuZpyXry_M02Zo--wJ0L8qMdeekyAjsBQhn7Pp7kEf6wOZt9gSrAFV6x3C2f93jiBLLTEvFGeeq3_nvQ7RqudNh4luONe-6JP5bUv1fAFasE4YYQ2VHEmInxCLv8Vr0zQY_3zhdFR-otkayQ8rrAr3S8tXN3RCbQiFRn8BYJRS1pKB-FGMtzc-cxPB0x0xVaLI0B3UrijPIBqPk52qHqlYeOVjF4OAiVFviju2I6rc2gelX-vF82cy-iSYU94qmJZtyidaHex5biPZtf7WNH2E6nKmcScFSVs1xf9_eRn4yhJjdTAhsiJPMacmGUIfr52oAXK0Ur6U5hGrnghHpQZahUKENn1KmJ1JuUSGWMBp8I5cRldSYCcaD65-jjSqgBMcPA_9KrKYawvcsinrkKLWZe1oeIsHZzmsyMrJt3ivl77T8zxPbPXUbFz81ZJbcAyFzGVePZt6s1GEW8ibRO7H0rB_AULdQ1m3PzHaL3wR0PSYjqVoaRYEtplqvKTHitLFF55X2Md_zhQiH-GyGx0-fIX2qx4X6jo31A1wmO5-xF18zDKhNcKxYpVm9SthtAmqUaXPDwb0HYam0OXRQsx2g6yrsgwav9hd0GoPH3vNU69E7T3g=s83-c'),
backgroundColor: Colors.transparent,
),
),
Row(children: [
Padding(padding: EdgeInsets.only(left: 10,bottom: 30), child:Text("Ammar Mohib \n",style: TextStyle(fontSize: 20,fontWeight: FontWeight.w500),)),
],),
Row(children: [
Padding(padding: EdgeInsets.only(right: 50,bottom: 30), child:Text("message",style: TextStyle(fontSize: 20,fontWeight: FontWeight.w500),)),
],),
],
),
这是我的代码,我想从右侧填充到第二个文本小部件,我想将第二个文本小部件设置为第一个文本小部件
我想要这样
请试试这个....
Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 15),
child: CircleAvatar(
radius: 30.0,
backgroundImage: NetworkImage(
'https://lh3.googleusercontent.com/fife/AAWUweVJ6fa0mu8MKDVxZb4AyDAY26PRa78SPnSUIJlo9fB6gnwWgQI-ARzrhqg2Z7X82PGJ_3VhJF385aL85wlg83NShyZcM_D-PdfabWVsu_q8nH4M9fWHp2KEolKaiuZpyXry_M02Zo--wJ0L8qMdeekyAjsBQhn7Pp7kEf6wOZt9gSrAFV6x3C2f93jiBLLTEvFGeeq3_nvQ7RqudNh4luONe-6JP5bUv1fAFasE4YYQ2VHEmInxCLv8Vr0zQY_3zhdFR-otkayQ8rrAr3S8tXN3RCbQiFRn8BYJRS1pKB-FGMtzc-cxPB0x0xVaLI0B3UrijPIBqPk52qHqlYeOVjF4OAiVFviju2I6rc2gelX-vF82cy-iSYU94qmJZtyidaHex5biPZtf7WNH2E6nKmcScFSVs1xf9_eRn4yhJjdTAhsiJPMacmGUIfr52oAXK0Ur6U5hGrnghHpQZahUKENn1KmJ1JuUSGWMBp8I5cRldSYCcaD65-jjSqgBMcPA_9KrKYawvcsinrkKLWZe1oeIsHZzmsyMrJt3ivl77T8zxPbPXUbFz81ZJbcAyFzGVePZt6s1GEW8ibRO7H0rB_AULdQ1m3PzHaL3wR0PSYjqVoaRYEtplqvKTHitLFF55X2Md_zhQiH-GyGx0-fIX2qx4X6jo31A1wmO5-xF18zDKhNcKxYpVm9SthtAmqUaXPDwb0HYam0OXRQsx2g6yrsgwav9hd0GoPH3vNU69E7T3g=s83-c'),
backgroundColor: Colors.transparent,
),
),
SizedBox(width: 10,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Ammar Mohib",
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w500),
),
Text(
"message",
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w500,),
),
],
)
],
),
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: ListView.separated(
separatorBuilder: (separaterContext, index) {
return const Divider(
color: Colors.grey,
indent: 70.0,
endIndent: 10.0,
thickness: 0.2,
);
},
itemCount: 5,
itemBuilder: (listViewContext, index) {
return ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0),
leading: const CircleAvatar(
radius: 30.0,
backgroundImage: NetworkImage(
'https://lh3.googleusercontent.com/fife/AAWUweVJ6fa0mu8MKDVxZb4AyDAY26PRa78SPnSUIJlo9fB6gnwWgQI-ARzrhqg2Z7X82PGJ_3VhJF385aL85wlg83NShyZcM_D-PdfabWVsu_q8nH4M9fWHp2KEolKaiuZpyXry_M02Zo--wJ0L8qMdeekyAjsBQhn7Pp7kEf6wOZt9gSrAFV6x3C2f93jiBLLTEvFGeeq3_nvQ7RqudNh4luONe-6JP5bUv1fAFasE4YYQ2VHEmInxCLv8Vr0zQY_3zhdFR-otkayQ8rrAr3S8tXN3RCbQiFRn8BYJRS1pKB-FGMtzc-cxPB0x0xVaLI0B3UrijPIBqPk52qHqlYeOVjF4OAiVFviju2I6rc2gelX-vF82cy-iSYU94qmJZtyidaHex5biPZtf7WNH2E6nKmcScFSVs1xf9_eRn4yhJjdTAhsiJPMacmGUIfr52oAXK0Ur6U5hGrnghHpQZahUKENn1KmJ1JuUSGWMBp8I5cRldSYCcaD65-jjSqgBMcPA_9KrKYawvcsinrkKLWZe1oeIsHZzmsyMrJt3ivl77T8zxPbPXUbFz81ZJbcAyFzGVePZt6s1GEW8ibRO7H0rB_AULdQ1m3PzHaL3wR0PSYjqVoaRYEtplqvKTHitLFF55X2Md_zhQiH-GyGx0-fIX2qx4X6jo31A1wmO5-xF18zDKhNcKxYpVm9SthtAmqUaXPDwb0HYam0OXRQsx2g6yrsgwav9hd0GoPH3vNU69E7T3g=s83-c'),
backgroundColor: Colors.transparent,
),
title: Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [
Expanded(
child: Text(
"Ammar Mohib",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
SizedBox(width: 10.0),
Text(
"10:10 AM",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Colors.grey,
),
),
],
),
subtitle: Flex(
direction: Axis.horizontal,
children: [
const Expanded(
child: Text(
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
style: TextStyle(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 10.0),
Container(
decoration: const BoxDecoration(
color: Colors.green,
shape: BoxShape.circle,
),
padding: const EdgeInsets.all(8.0),
child: const Text(
"99+",
style: TextStyle(
fontSize: 9.0,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
],
),
);
},
),
);
}
}
Row(
children: [
Padding(
padding: const EdgeInsets.only(left:15),
child: CircleAvatar(
radius: 30.0,
backgroundImage:NetworkImage('https://lh3.googleusercontent.com/fife/AAWUweVJ6fa0mu8MKDVxZb4AyDAY26PRa78SPnSUIJlo9fB6gnwWgQI-ARzrhqg2Z7X82PGJ_3VhJF385aL85wlg83NShyZcM_D-PdfabWVsu_q8nH4M9fWHp2KEolKaiuZpyXry_M02Zo--wJ0L8qMdeekyAjsBQhn7Pp7kEf6wOZt9gSrAFV6x3C2f93jiBLLTEvFGeeq3_nvQ7RqudNh4luONe-6JP5bUv1fAFasE4YYQ2VHEmInxCLv8Vr0zQY_3zhdFR-otkayQ8rrAr3S8tXN3RCbQiFRn8BYJRS1pKB-FGMtzc-cxPB0x0xVaLI0B3UrijPIBqPk52qHqlYeOVjF4OAiVFviju2I6rc2gelX-vF82cy-iSYU94qmJZtyidaHex5biPZtf7WNH2E6nKmcScFSVs1xf9_eRn4yhJjdTAhsiJPMacmGUIfr52oAXK0Ur6U5hGrnghHpQZahUKENn1KmJ1JuUSGWMBp8I5cRldSYCcaD65-jjSqgBMcPA_9KrKYawvcsinrkKLWZe1oeIsHZzmsyMrJt3ivl77T8zxPbPXUbFz81ZJbcAyFzGVePZt6s1GEW8ibRO7H0rB_AULdQ1m3PzHaL3wR0PSYjqVoaRYEtplqvKTHitLFF55X2Md_zhQiH-GyGx0-fIX2qx4X6jo31A1wmO5-xF18zDKhNcKxYpVm9SthtAmqUaXPDwb0HYam0OXRQsx2g6yrsgwav9hd0GoPH3vNU69E7T3g=s83-c'),
backgroundColor: Colors.transparent,
),
),
Row(children: [
Padding(padding: EdgeInsets.only(left: 10,bottom: 30), child:Text("Ammar Mohib \n",style: TextStyle(fontSize: 20,fontWeight: FontWeight.w500),)),
],),
Row(children: [
Padding(padding: EdgeInsets.only(right: 50,bottom: 30), child:Text("message",style: TextStyle(fontSize: 20,fontWeight: FontWeight.w500),)),
],),
],
),
这是我的代码,我想从右侧填充到第二个文本小部件,我想将第二个文本小部件设置为第一个文本小部件
我想要这样
请试试这个....
Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 15),
child: CircleAvatar(
radius: 30.0,
backgroundImage: NetworkImage(
'https://lh3.googleusercontent.com/fife/AAWUweVJ6fa0mu8MKDVxZb4AyDAY26PRa78SPnSUIJlo9fB6gnwWgQI-ARzrhqg2Z7X82PGJ_3VhJF385aL85wlg83NShyZcM_D-PdfabWVsu_q8nH4M9fWHp2KEolKaiuZpyXry_M02Zo--wJ0L8qMdeekyAjsBQhn7Pp7kEf6wOZt9gSrAFV6x3C2f93jiBLLTEvFGeeq3_nvQ7RqudNh4luONe-6JP5bUv1fAFasE4YYQ2VHEmInxCLv8Vr0zQY_3zhdFR-otkayQ8rrAr3S8tXN3RCbQiFRn8BYJRS1pKB-FGMtzc-cxPB0x0xVaLI0B3UrijPIBqPk52qHqlYeOVjF4OAiVFviju2I6rc2gelX-vF82cy-iSYU94qmJZtyidaHex5biPZtf7WNH2E6nKmcScFSVs1xf9_eRn4yhJjdTAhsiJPMacmGUIfr52oAXK0Ur6U5hGrnghHpQZahUKENn1KmJ1JuUSGWMBp8I5cRldSYCcaD65-jjSqgBMcPA_9KrKYawvcsinrkKLWZe1oeIsHZzmsyMrJt3ivl77T8zxPbPXUbFz81ZJbcAyFzGVePZt6s1GEW8ibRO7H0rB_AULdQ1m3PzHaL3wR0PSYjqVoaRYEtplqvKTHitLFF55X2Md_zhQiH-GyGx0-fIX2qx4X6jo31A1wmO5-xF18zDKhNcKxYpVm9SthtAmqUaXPDwb0HYam0OXRQsx2g6yrsgwav9hd0GoPH3vNU69E7T3g=s83-c'),
backgroundColor: Colors.transparent,
),
),
SizedBox(width: 10,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Ammar Mohib",
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w500),
),
Text(
"message",
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w500,),
),
],
)
],
),
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: ListView.separated(
separatorBuilder: (separaterContext, index) {
return const Divider(
color: Colors.grey,
indent: 70.0,
endIndent: 10.0,
thickness: 0.2,
);
},
itemCount: 5,
itemBuilder: (listViewContext, index) {
return ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0),
leading: const CircleAvatar(
radius: 30.0,
backgroundImage: NetworkImage(
'https://lh3.googleusercontent.com/fife/AAWUweVJ6fa0mu8MKDVxZb4AyDAY26PRa78SPnSUIJlo9fB6gnwWgQI-ARzrhqg2Z7X82PGJ_3VhJF385aL85wlg83NShyZcM_D-PdfabWVsu_q8nH4M9fWHp2KEolKaiuZpyXry_M02Zo--wJ0L8qMdeekyAjsBQhn7Pp7kEf6wOZt9gSrAFV6x3C2f93jiBLLTEvFGeeq3_nvQ7RqudNh4luONe-6JP5bUv1fAFasE4YYQ2VHEmInxCLv8Vr0zQY_3zhdFR-otkayQ8rrAr3S8tXN3RCbQiFRn8BYJRS1pKB-FGMtzc-cxPB0x0xVaLI0B3UrijPIBqPk52qHqlYeOVjF4OAiVFviju2I6rc2gelX-vF82cy-iSYU94qmJZtyidaHex5biPZtf7WNH2E6nKmcScFSVs1xf9_eRn4yhJjdTAhsiJPMacmGUIfr52oAXK0Ur6U5hGrnghHpQZahUKENn1KmJ1JuUSGWMBp8I5cRldSYCcaD65-jjSqgBMcPA_9KrKYawvcsinrkKLWZe1oeIsHZzmsyMrJt3ivl77T8zxPbPXUbFz81ZJbcAyFzGVePZt6s1GEW8ibRO7H0rB_AULdQ1m3PzHaL3wR0PSYjqVoaRYEtplqvKTHitLFF55X2Md_zhQiH-GyGx0-fIX2qx4X6jo31A1wmO5-xF18zDKhNcKxYpVm9SthtAmqUaXPDwb0HYam0OXRQsx2g6yrsgwav9hd0GoPH3vNU69E7T3g=s83-c'),
backgroundColor: Colors.transparent,
),
title: Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [
Expanded(
child: Text(
"Ammar Mohib",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
SizedBox(width: 10.0),
Text(
"10:10 AM",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Colors.grey,
),
),
],
),
subtitle: Flex(
direction: Axis.horizontal,
children: [
const Expanded(
child: Text(
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
style: TextStyle(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 10.0),
Container(
decoration: const BoxDecoration(
color: Colors.green,
shape: BoxShape.circle,
),
padding: const EdgeInsets.all(8.0),
child: const Text(
"99+",
style: TextStyle(
fontSize: 9.0,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
],
),
);
},
),
);
}
}