布局案例

 

布局案例

 

 

import 'package:flutter/material.dart'; import 'res/listData.dart';
void main() {   runApp(MyApp()); }
class MyApp extends StatelessWidget {   @override   Widget build(BuildContext context) {     return MaterialApp(         home: Scaffold(       appBar: AppBar(title: Text("flutterDemo")),       body: HomeContent(),     ));   } }
class HomeContent extends StatelessWidget {   @override   Widget build(BuildContext context) {     return Column(       children: [         Row(           children: [             Expanded(               child: Container(                 height: 180,                 color: Colors.black,                 child: Text('你好Flutter'),               ),             )           ],         ),         SizedBox(           height: 10,         ),         Row(           children: [             Expanded(               flex: 2,               child: Container(                   height: 180,                   child: Image.network(                     "https://www.itying.com/images/flutter/1.png",                     fit: BoxFit.cover,                   )),             ),             SizedBox(               width: 10,             ),             Expanded(               flex: 1,               child: Container(                 height: 180,                 child: ListView(                   children: [                     Container(                       height: 85,                       child: Image.network(                         "https://www.itying.com/images/flutter/1.png",                         fit: BoxFit.cover,                       ),                     ),                     SizedBox(                       height: 10,                     ),                     Container(                       height: 85,                       child: Image.network(                         "https://www.itying.com/images/flutter/1.png",                         fit: BoxFit.cover,                       ),                     )                   ],                 ),               ),             ),           ],         )       ],     );   } }  
上一篇:前端开发技术之JavaScript运算符的使用技巧


下一篇:扁平数组和树形结构的相互转换