parent
5ec61c6527
commit
7d3dc6878e
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 4.5 KiB |
@ -0,0 +1,58 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:recook/constants/header.dart';
|
||||||
|
import 'package:recook/pages/lottery/widget/lottery_scaffold.dart';
|
||||||
|
|
||||||
|
class LotteryPickerPage extends StatefulWidget {
|
||||||
|
LotteryPickerPage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_LotteryPickerPageState createState() => _LotteryPickerPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LotteryPickerPageState extends State<LotteryPickerPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return LotteryScaffold(
|
||||||
|
red: true,
|
||||||
|
title: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'双色球',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: rSP(18),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'明日',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: rSP(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: rSize(20),
|
||||||
|
onPressed: () {},
|
||||||
|
child: Image.asset(
|
||||||
|
R.ASSETS_LOTTERY_REDEEM_LOTTERY_DETAIL_PNG,
|
||||||
|
width: rSize(20),
|
||||||
|
height: rSize(20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: rSize(20),
|
||||||
|
onPressed: () {},
|
||||||
|
child: Image.asset(
|
||||||
|
R.ASSETS_LOTTERY_REDEEM_LOTTERY_HISTORY_PNG,
|
||||||
|
width: rSize(20),
|
||||||
|
height: rSize(20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
body: SizedBox(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,134 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:recook/constants/header.dart';
|
||||||
|
import 'package:recook/pages/lottery/widget/lottery_result_boxes.dart';
|
||||||
|
import 'package:recook/pages/lottery/widget/lottery_scaffold.dart';
|
||||||
|
import 'package:recook/widgets/custom_image_button.dart';
|
||||||
|
|
||||||
|
enum LotteryType {
|
||||||
|
DOUBLE_LOTTERY,
|
||||||
|
BIG_LOTTERY,
|
||||||
|
}
|
||||||
|
|
||||||
|
class RedeemLotteryPage extends StatefulWidget {
|
||||||
|
RedeemLotteryPage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_RedeemLotteryPageState createState() => _RedeemLotteryPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RedeemLotteryPageState extends State<RedeemLotteryPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return LotteryScaffold(
|
||||||
|
title: '彩票兑换',
|
||||||
|
actions: [
|
||||||
|
MaterialButton(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: rSize(16)),
|
||||||
|
minWidth: rSize(52),
|
||||||
|
onPressed: () {},
|
||||||
|
child: Image.asset(
|
||||||
|
R.ASSETS_LOTTERY_REDEEM_LOTTERY_LIST_PNG,
|
||||||
|
width: rSize(20),
|
||||||
|
height: rSize(20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
_lotteryCard(
|
||||||
|
type: LotteryType.DOUBLE_LOTTERY,
|
||||||
|
redBalls: [2, 6, 11, 14, 18, 22],
|
||||||
|
blueBalls: [02],
|
||||||
|
),
|
||||||
|
_lotteryCard(
|
||||||
|
type: LotteryType.BIG_LOTTERY,
|
||||||
|
redBalls: [2, 6, 11, 14, 18],
|
||||||
|
blueBalls: [7, 12],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_lotteryCard({
|
||||||
|
LotteryType type,
|
||||||
|
List<int> redBalls,
|
||||||
|
List<int> blueBalls,
|
||||||
|
}) {
|
||||||
|
String title = type == LotteryType.DOUBLE_LOTTERY ? "双色球" : "大乐透";
|
||||||
|
String asset = type == LotteryType.DOUBLE_LOTTERY
|
||||||
|
? R.ASSETS_LOTTERY_REDEEM_DOUBLE_LOTTERY_PNG
|
||||||
|
: R.ASSETS_LOTTERY_REDEEM_BIG_LOTTERY_PNG;
|
||||||
|
|
||||||
|
return CustomImageButton(
|
||||||
|
onPressed: () {
|
||||||
|
AppRouter.push(context, RouteName.LOTTERY_PICKER_PAGE);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(rSize(16)),
|
||||||
|
margin: EdgeInsets.symmetric(
|
||||||
|
vertical: rSize(8),
|
||||||
|
horizontal: rSize(16),
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(rSize(4)),
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
asset,
|
||||||
|
width: rSize(36),
|
||||||
|
height: rSize(36),
|
||||||
|
),
|
||||||
|
SizedBox(width: rSize(10)),
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF333333),
|
||||||
|
fontSize: rSP(16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'DATE',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF666666),
|
||||||
|
fontSize: rSP(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
color: Color(0xFFD7D7D7),
|
||||||
|
size: rSize(16),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: rSize(20)),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: LotteryResultBoxes(
|
||||||
|
type: type,
|
||||||
|
redBalls: redBalls,
|
||||||
|
blueBalls: blueBalls,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: rSize(34)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:recook/constants/header.dart';
|
||||||
|
|
||||||
|
enum LotteryColorType {
|
||||||
|
RED,
|
||||||
|
BLUE,
|
||||||
|
}
|
||||||
|
|
||||||
|
class LotteryBall extends StatelessWidget {
|
||||||
|
final LotteryColorType type;
|
||||||
|
final int ball;
|
||||||
|
const LotteryBall({
|
||||||
|
Key key,
|
||||||
|
@required this.type,
|
||||||
|
@required this.ball,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
String _computeBallDisplayValue() {
|
||||||
|
if (ball < 10)
|
||||||
|
return "0$ball";
|
||||||
|
else
|
||||||
|
return "$ball";
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final isRed = type == LotteryColorType.RED;
|
||||||
|
return Container(
|
||||||
|
height: rSize(32),
|
||||||
|
width: rSize(32),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(rSize(16)),
|
||||||
|
color: isRed ? Color(0xFFE02020) : Color(0xFF0E89E7),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
_computeBallDisplayValue(),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: rSP(14),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:recook/pages/lottery/redeem_lottery_page.dart';
|
||||||
|
import 'package:recook/pages/lottery/widget/lottery_ball.dart';
|
||||||
|
|
||||||
|
class LotteryResultBoxes extends StatelessWidget {
|
||||||
|
final LotteryType type;
|
||||||
|
final List<int> redBalls;
|
||||||
|
final List<int> blueBalls;
|
||||||
|
const LotteryResultBoxes({Key key, this.type, this.redBalls, this.blueBalls})
|
||||||
|
//红球数量限制
|
||||||
|
: assert(redBalls.length == (type == LotteryType.DOUBLE_LOTTERY ? 6 : 5),
|
||||||
|
"红球数量错误"),
|
||||||
|
//篮球数量限制
|
||||||
|
assert(
|
||||||
|
blueBalls.length == (type == LotteryType.DOUBLE_LOTTERY ? 1 : 2)),
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: redBalls
|
||||||
|
.map(
|
||||||
|
(element) => LotteryBall(type: LotteryColorType.RED, ball: element),
|
||||||
|
)
|
||||||
|
.toList()
|
||||||
|
..addAll(
|
||||||
|
blueBalls.map(
|
||||||
|
(e) => LotteryBall(type: LotteryColorType.BLUE, ball: e),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:recook/constants/styles.dart';
|
||||||
|
import 'package:recook/widgets/custom_app_bar.dart';
|
||||||
|
import 'package:recook/widgets/recook_back_button.dart';
|
||||||
|
|
||||||
|
class LotteryScaffold extends StatefulWidget {
|
||||||
|
final dynamic title;
|
||||||
|
final bool red;
|
||||||
|
final List<Widget> actions;
|
||||||
|
final Widget body;
|
||||||
|
final Widget bottomNavi;
|
||||||
|
LotteryScaffold({
|
||||||
|
Key key,
|
||||||
|
@required this.title,
|
||||||
|
this.red = false,
|
||||||
|
this.actions,
|
||||||
|
this.body,
|
||||||
|
this.bottomNavi,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_LotteryScaffoldState createState() => _LotteryScaffoldState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LotteryScaffoldState extends State<LotteryScaffold> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Color(0xFFF9F9FB),
|
||||||
|
appBar: CustomAppBar(
|
||||||
|
elevation: 0,
|
||||||
|
title: widget.title is String
|
||||||
|
? Text(
|
||||||
|
widget.title,
|
||||||
|
style: TextStyle(color: AppColor.blackColor),
|
||||||
|
)
|
||||||
|
: widget.title,
|
||||||
|
leading: RecookBackButton(
|
||||||
|
white: widget.red,
|
||||||
|
),
|
||||||
|
appBackground: widget.red ? Color(0xFFE02020) : Color(0xFFF9F9FB),
|
||||||
|
actions: widget.actions,
|
||||||
|
),
|
||||||
|
body: widget.body,
|
||||||
|
bottomNavigationBar: widget.bottomNavi,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:recook/constants/app_image_resources.dart';
|
||||||
|
import 'package:recook/constants/styles.dart';
|
||||||
|
|
||||||
|
class RecookBackButton extends StatelessWidget {
|
||||||
|
final bool white;
|
||||||
|
const RecookBackButton({Key key, this.white = false}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (Navigator.canPop(context)) {
|
||||||
|
return IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
AppIcons.icon_back,
|
||||||
|
size: 17,
|
||||||
|
color: white ? Colors.white : AppColor.blackColor,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.maybePop(context);
|
||||||
|
});
|
||||||
|
} else
|
||||||
|
return SizedBox();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue