提交 fc80bfa6 authored 作者: yueweilu's avatar yueweilu

图书展示 使用统一自定义组件

上级 33ce5c6e
...@@ -27,27 +27,8 @@ class BuildBook extends StatelessWidget { ...@@ -27,27 +27,8 @@ class BuildBook extends StatelessWidget {
margin: const EdgeInsets.only(left: 15,right: 15), margin: const EdgeInsets.only(left: 15,right: 15),
child: Row( child: Row(
children: [ children: [
Container( CustomCard(
decoration: BoxDecoration( url: model.img??'',
color: Colors.cyan,
borderRadius: BorderRadius.circular(3),
boxShadow: [
BoxShadow(
color: const Color(0xFF707070).withOpacity(0.5),
spreadRadius: 0,
blurRadius: 4.5,
offset: const Offset(0, 0), // changes the position of the shadow
),
]
),
// color: Colors.white,
height: 102,
width: 85,
child: Container(
padding: const EdgeInsets.all(1),
child: CustomImage.network(url: model.img??'')
),
) )
], ],
), ),
......
...@@ -10,6 +10,7 @@ import 'package:get/get.dart'; ...@@ -10,6 +10,7 @@ import 'package:get/get.dart';
import '../../models/index.dart'; import '../../models/index.dart';
import '../../models/shop.dart'; import '../../models/shop.dart';
import '../../utils/index.dart'; import '../../utils/index.dart';
import '../../widgets/index.dart';
import '../book_shop/index.dart'; import '../book_shop/index.dart';
import 'dart:io'; import 'dart:io';
......
...@@ -31,29 +31,10 @@ class BuildItem extends StatelessWidget { ...@@ -31,29 +31,10 @@ class BuildItem extends StatelessWidget {
margin: const EdgeInsets.only(left: 12,right: 11), margin: const EdgeInsets.only(left: 12,right: 11),
child: Row( child: Row(
children: [ children: [
Container( CustomCard(
decoration: BoxDecoration(
color: Colors.cyan,
borderRadius: BorderRadius.circular(3),
boxShadow: [
BoxShadow(
color: const Color(0xFF707070).withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: const Offset(3, 0), // changes the position of the shadow
),
]
),
// color: Colors.white,
height: 86,
width: 72, width: 72,
child: Container( height: 86,
padding: const EdgeInsets.all(2), url: model.img??'',
child: Container(
color: Colors.cyan,
),
),
) )
], ],
), ),
......
...@@ -57,29 +57,10 @@ class BookCell extends StatelessWidget { ...@@ -57,29 +57,10 @@ class BookCell extends StatelessWidget {
child: Image.asset(model.selected?'assets/images/pay_check.png':'assets/images/pay_uncheck.png'), child: Image.asset(model.selected?'assets/images/pay_check.png':'assets/images/pay_uncheck.png'),
), ),
const SizedBox(width: 12,), const SizedBox(width: 12,),
Container( CustomCard(
decoration: BoxDecoration(
color: Colors.cyan,
borderRadius: BorderRadius.circular(3),
boxShadow: [
BoxShadow(
color: const Color(0xFF707070).withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: const Offset(3, 0), // changes the position of the shadow
),
]
),
// color: Colors.white,
height: 86,
width: 72, width: 72,
child: Container( height: 86,
padding: const EdgeInsets.all(2), url: model.img??'',
child: Container(
color: Colors.cyan,
),
),
) )
], ],
), ),
......
...@@ -30,22 +30,9 @@ class Book extends StatelessWidget { ...@@ -30,22 +30,9 @@ class Book extends StatelessWidget {
Expanded( Expanded(
child: AspectRatio( child: AspectRatio(
aspectRatio: 0.85, aspectRatio: 0.85,
child: Container( child: CustomCard(
decoration: BoxDecoration( url: model.img??'',
borderRadius: BorderRadius.circular(3), )
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFF707070).withOpacity(0.5),
offset: const Offset(0, 0),
blurRadius: 4.5.w,
spreadRadius: 0.w,
),
],
),
padding: const EdgeInsets.all(1),
child: CustomImage.network(url: model.img??''),
),
), ),
), ),
Gaps.vGaps10, Gaps.vGaps10,
......
...@@ -88,14 +88,10 @@ class LibraryCell extends StatelessWidget { ...@@ -88,14 +88,10 @@ class LibraryCell extends StatelessWidget {
left: 20, left: 20,
top: 0, top: 0,
bottom: 18, bottom: 18,
child: Container( child: CustomCard(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Colors.cyan,
),
width: 100, width: 100,
child: CustomImage.network(url: model.img??''), url: model.img??'',
), )
), ),
], ],
) )
......
...@@ -67,12 +67,10 @@ class BuildDayItem extends StatelessWidget { ...@@ -67,12 +67,10 @@ class BuildDayItem extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( CustomCard(
width: 72, width: 72,
height: 87, height: 86,
// color: Colors.red, url: courseModel.img??'',
child: CustomImage.network(url: courseModel.img??'')
// Image.network(courseModel.img??''),
), ),
Expanded( Expanded(
child: Container( child: Container(
......
...@@ -57,10 +57,10 @@ class BuildItem extends StatelessWidget { ...@@ -57,10 +57,10 @@ class BuildItem extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( CustomCard(
height: 87, width: 72,
width: 73, height: 86,
color: Colors.cyan, url: model.img??'',
), ),
Container( Container(
height: 87, height: 87,
......
...@@ -32,10 +32,10 @@ class BuildItem extends StatelessWidget { ...@@ -32,10 +32,10 @@ class BuildItem extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( CustomCard(
height: 87, width: 72,
width: 73, height: 86,
color: Colors.cyan, url: model.img??'',
), ),
Container( Container(
height: 87, height: 87,
......
...@@ -32,11 +32,10 @@ class BuildItem extends StatelessWidget { ...@@ -32,11 +32,10 @@ class BuildItem extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
/// 左侧 /// 左侧
Container( CustomCard(
width: 73, width: 72,
height: 87, height: 86,
color: Colors.red, url: model.img??'',
child: CustomImage.network(url: model.img??''),
), ),
/// 右侧 /// 右侧
Expanded( Expanded(
......
...@@ -56,10 +56,10 @@ class BuildItem extends StatelessWidget { ...@@ -56,10 +56,10 @@ class BuildItem extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( CustomCard(
height: 87, width: 72,
width: 73, height: 86,
color: Colors.cyan, url: model.img??'',
), ),
Container( Container(
height: 87, height: 87,
......
...@@ -32,10 +32,10 @@ class BuildItem extends StatelessWidget { ...@@ -32,10 +32,10 @@ class BuildItem extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( CustomCard(
height: 87, width: 72,
width: 73, height: 86,
color: Colors.cyan, url: model.img??'',
), ),
Container( Container(
height: 87, height: 87,
......
...@@ -13,6 +13,12 @@ class UserWrongController extends GetxController { ...@@ -13,6 +13,12 @@ class UserWrongController extends GetxController {
int _page = 1; int _page = 1;
bool _noMore = false; bool _noMore = false;
@override
void onReady() {
onRefresh();
super.onReady();
}
@override @override
void onClose() { void onClose() {
refreshController.dispose(); refreshController.dispose();
......
...@@ -19,7 +19,7 @@ class _UserWrongPageState extends State<UserWrongPage> { ...@@ -19,7 +19,7 @@ class _UserWrongPageState extends State<UserWrongPage> {
), ),
body: CustomPullScrollView( body: CustomPullScrollView(
controller: controller.refreshController, controller: controller.refreshController,
onRefresh: controller.onRefresh, // onRefresh: controller.onRefresh,
onLoading: controller.onLoading, onLoading: controller.onLoading,
child:SingleChildScrollView( child:SingleChildScrollView(
child: Container( child: Container(
......
...@@ -55,10 +55,10 @@ class BuildItem extends StatelessWidget { ...@@ -55,10 +55,10 @@ class BuildItem extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( CustomCard(
height: 87, width: 72,
width: 73, height: 86,
color: Colors.cyan, url: model.img??'',
), ),
Container( Container(
height: 87, height: 87,
......
part of widgets;
class CustomCard extends StatelessWidget {
final String url;
final double height;
final double width;
final BorderRadiusGeometry? borderRadius;
final List<BoxShadow>? boxShadow;
const CustomCard({super.key,
required this.url,
this.height = 102,
this.width = 85,
this.borderRadius,
this.boxShadow,
});
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.cyan,
borderRadius: borderRadius ?? BorderRadius.circular(3),
boxShadow: boxShadow ?? [
BoxShadow(
color: const Color(0xFF707070).withOpacity(0.5),
spreadRadius: 0,
blurRadius: 4.5,
offset: const Offset(0, 0),
),
],
),
height: height,
width: width,
child: Container(
padding: const EdgeInsets.all(1),
child: CustomImage.network(url: url),
),
);
}
}
...@@ -24,4 +24,5 @@ part 'input.dart'; ...@@ -24,4 +24,5 @@ part 'input.dart';
part 'button.dart'; part 'button.dart';
part 'pull_scroll_view.dart'; part 'pull_scroll_view.dart';
part 'tab_bar.dart'; part 'tab_bar.dart';
part 'dialog.dart'; part 'dialog.dart';
\ No newline at end of file part 'book.dart';
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论