poem_video_player.dart
3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import 'package:fijkplayer/fijkplayer.dart';
import 'package:flutter/material.dart';
import 'package:one_poem/res/resources.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/widgets/my_app_bar.dart';
import 'package:one_poem/extension/int_extension.dart';
import '../poem_router.dart';
class PoemVideoPlayer extends StatefulWidget {
final String url;
final String? title;
const PoemVideoPlayer({
Key? key,
required this.url,
this.title,
}) : super(key: key);
@override
_PoemVideoPlayerState createState() => _PoemVideoPlayerState();
}
class _PoemVideoPlayerState extends State<PoemVideoPlayer> {
final FijkPlayer player = FijkPlayer();
_PoemVideoPlayerState();
@override
void initState() {
super.initState();
// player.setDataSource(widget.url, autoPlay: true);
//TODO 替换真实URL
player.setDataSource(
"asset:///assets/data/video_01.mp4",
autoPlay: true,
);
player.setLoop(0);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
homeMenuHeader: Container(
alignment: Alignment.center,
child: Text(
widget.title ?? "视频播放",
style: const TextStyle(
color: Colors.white,
),
),
),
),
body: Stack(
children: [
FijkView(
height: MediaQuery.of(context).size.height,
player: player,
fit: FijkFit.fill,
),
Padding(
padding: EdgeInsets.fromLTRB(10.px, 30.px, 10.px, 10.px),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"题破山寺后禅院",
style: TextStyle(
color: Colors.white,
fontSize: 28.px,
),
),
Gaps.vGap10,
Text(
"常建",
style: TextStyle(
color: Colors.white,
fontSize: 15.px,
),
),
Gaps.vGap5,
Text(
"清晨入古寺,\n初日照高林。\n曲径通幽处,\n禅房花木深。\n山光悦鸟性,\n潭影空人心。\n万籁此都寂,\n但余钟磬音。\n",
style: TextStyle(
color: Colors.white,
fontFamily: "ZCOOLXiaoWei",
fontSize: 25.px,
),
),
Gaps.vGap5,
Text(
"临者:老魔取西经",
style: TextStyle(
color: Colors.white,
fontSize: 15.px,
),
),
Text(
"2022年01月25日 辰时三刻",
style: TextStyle(
color: Colors.white,
fontSize: 15.px,
),
),
],
),
),
Positioned(
bottom: 10.px,
right: 20.px,
child: ElevatedButton(
onPressed: () {
NavigatorUtils.push(
context,
'${PoemRouter.poemPublish}?data=100',
clearStack: true
);
},
child: Text(
"下一步",
style: TextStyle(fontSize: 15.px),
),
style: TextButton.styleFrom(
primary: Colors.white,
backgroundColor: Colors.black54,
),
),
),
],
));
}
@override
void dispose() {
player.release();
super.dispose();
}
}