准备顶部数据
This commit is contained in:
parent
3ceb666de4
commit
5572c8bc62
@ -1,3 +1,4 @@
|
|||||||
|
// ignore_for_file: dead_code
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:transparent_image/transparent_image.dart';
|
import 'package:transparent_image/transparent_image.dart';
|
||||||
@ -8,6 +9,8 @@ class HomePageView extends GetView {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
const title = "壁纸";
|
const title = "壁纸";
|
||||||
|
final ListView headerView = getHeaderWidget();
|
||||||
|
final GridView bodyView = getBodyWidget();
|
||||||
|
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: title,
|
title: title,
|
||||||
@ -15,7 +18,23 @@ class HomePageView extends GetView {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text(title),
|
title: const Text(title),
|
||||||
),
|
),
|
||||||
body: GridView.count(
|
body: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 400,
|
||||||
|
height: 40,
|
||||||
|
child: headerView,
|
||||||
|
),
|
||||||
|
// bodyView,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回内容
|
||||||
|
GridView getBodyWidget(){
|
||||||
|
return GridView.count(
|
||||||
// Create a grid with 2 columns. If you change the scrollDirection to
|
// Create a grid with 2 columns. If you change the scrollDirection to
|
||||||
// horizontal, this produces 2 rows.
|
// horizontal, this produces 2 rows.
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
@ -28,8 +47,36 @@ class HomePageView extends GetView {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//初始化顶部数据
|
||||||
|
ListView getHeaderWidget(){
|
||||||
|
return ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 160,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 160,
|
||||||
|
color: Colors.blue,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 160,
|
||||||
|
color: Colors.green,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 160,
|
||||||
|
color: Colors.yellow,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 160,
|
||||||
|
color: Colors.orange,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user