Guest User

Untitled

a guest
Jun 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.21 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:chewie/chewie.dart';
  3. import 'package:video_player/video_player.dart';
  4. import 'featured.dart';
  5. import 'profile.dart';
  6. import 'package:flutter/cupertino.dart';
  7.  
  8. void main() => runApp(RambleApp());
  9.  
  10. class RambleApp extends StatelessWidget {
  11. // This widget is the root of your application.
  12.  
  13. @override
  14. Widget build(BuildContext context) {
  15. return MaterialApp(
  16. title: "Title",
  17. home: VideoBG(),
  18. );
  19. }
  20. }
  21.  
  22. class VideoBG extends StatefulWidget {
  23. @override
  24. VideoState createState() => VideoState();
  25. }
  26.  
  27. class VideoState extends State<VideoBG> {
  28. VideoPlayerController _controller;
  29.  
  30. @override
  31. void initState() {
  32. super.initState();
  33. _controller = new VideoPlayerController.asset('assets/Video.mp4');
  34. }
  35.  
  36. @override
  37. Widget build(BuildContext context) {
  38. return new Stack(
  39. fit: StackFit.passthrough,
  40. children: [
  41. new ClipRect(
  42. child: new OverflowBox(
  43. maxWidth: double.infinity,
  44. maxHeight: double.infinity,
  45. alignment: Alignment.center,
  46. child: new FittedBox(
  47. fit: BoxFit.cover,
  48. alignment: Alignment.center,
  49. child: new Container(
  50. child: new Chewie( //video player
  51. _controller,
  52. autoPlay: true,
  53. looping: true,
  54. autoInitialize: true,
  55. showControls: false,
  56. ),
  57. ),
  58. ),
  59. ),
  60. ),
  61. new Container(
  62. margin: EdgeInsets.all(40.0),
  63. decoration: BoxDecoration(
  64. image: DecorationImage(
  65. alignment: Alignment(0.0, -0.75),
  66. image: AssetImage('assets/title.png')
  67. ),
  68. ),
  69. ),
  70. new Container(
  71. alignment: new Alignment(0.0, 0.65),
  72. child: new Row(
  73. crossAxisAlignment: CrossAxisAlignment.center,
  74. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  75. children: <Widget>[
  76. new Container(
  77. child: new FlatButton(
  78. child: new Text(
  79. 'TEXT ONE',
  80. style: new TextStyle(
  81. fontWeight: FontWeight.w900,
  82. fontSize: 17.5,
  83. ),
  84. ),
  85. color: Color(0xFF70E0EF),
  86. shape: new RoundedRectangleBorder(
  87. borderRadius: new BorderRadius.circular(7.5)
  88. ),
  89. onPressed: () {
  90. _controller.pause();
  91. Navigator.push(
  92. context,
  93. new MaterialPageRoute(builder: (context) => new FeaturedScreen()),
  94. );
  95. },
  96. ),
  97. width: 150.0,
  98. height: 60.0,
  99. ),
  100. new Container(
  101. child: new OutlineButton(
  102. child: new Text(
  103. 'TEXT TWO',
  104. style: new TextStyle(
  105. fontWeight: FontWeight.w900,
  106. fontSize: 17.5,
  107. ),
  108. ),
  109. borderSide: new BorderSide(
  110. color: const Color(0xFF70E0EF),
  111. width: 5.0,
  112. style: BorderStyle.solid,
  113. ),
  114. shape: new RoundedRectangleBorder(
  115. borderRadius: new BorderRadius.circular(7.5),
  116. ),
  117. onPressed: () {
  118. _controller.pause();
  119. Navigator.push(
  120. context,
  121. new MaterialPageRoute(builder: (context) => new ProfileScreen()),
  122. );
  123. },
  124. ),
  125. width: 150.0,
  126. height: 60.0,
  127. ),
  128. ],
  129. ),
  130. ),
  131. ],
  132. );
  133. }
  134. }
  135.  
  136. import 'package:flutter/material.dart';
  137. import 'profile.dart';
  138. import 'search.dart';
  139. import 'favorites.dart';
  140.  
  141. class FeaturedScreen extends StatelessWidget {
  142.  
  143. @override
  144. Widget build(BuildContext context) {
  145. return MaterialApp(
  146. home: Featured(),
  147. theme: new ThemeData(canvasColor: Color(0xffffffff).withOpacity(0.5)),
  148. );
  149. }
  150. }
  151.  
  152. class Featured extends StatefulWidget {
  153. @override
  154. FeaturedState createState() => FeaturedState();
  155. }
  156.  
  157. class FeaturedState extends State<Featured>{
  158.  
  159. int i = 0;
  160. var pages = [
  161. new FeaturedScreen(),
  162. new ProfileScreen(),
  163. new SearchScreen(),
  164. new FavoritesScreen(),
  165. ];
  166.  
  167. @override
  168. Widget build(BuildContext context) {
  169. return Stack(
  170. fit: StackFit.passthrough,
  171. children: [
  172. new Container(
  173. decoration: new BoxDecoration(
  174. image: new DecorationImage(
  175. image: new AssetImage('assets/FeaturedBG.png'),
  176. fit: BoxFit.cover
  177. ),
  178. ),
  179. ),
  180. new Scaffold(
  181. body: pages[i],
  182. bottomNavigationBar: BottomNavigationBar(
  183. items: <BottomNavigationBarItem>[
  184. BottomNavigationBarItem(
  185. icon: i==0?Icon(
  186. Icons.apps,
  187. color: Color(0xff70E0EF),
  188. size: 35.0,
  189. ):Icon(
  190. Icons.apps,
  191. color: Colors.black,
  192. size: 35.0,
  193. ),
  194. title: Text(
  195. 'Collections',
  196. style: new TextStyle(
  197. color: Colors.white,
  198. fontSize: 0.0,
  199. height: 0.0,
  200. ),
  201. ),
  202. ),
  203. BottomNavigationBarItem(
  204. icon: i==1?Icon(
  205. Icons.search,
  206. color: Color(0xff70E0EF),
  207. size: 35.0,
  208. ):Icon(
  209. Icons.search,
  210. color: Colors.black,
  211. size: 35.0,
  212. ),
  213. title: Text(
  214. 'Search',
  215. style: new TextStyle(
  216. color: Colors.white,
  217. fontSize: 0.0,
  218. height: 0.0,
  219. ),
  220. ),
  221. ),
  222. BottomNavigationBarItem(
  223. icon: i==2?Icon(
  224. Icons.favorite,
  225. color: Color(0xff70E0EF),
  226. size: 35.0,
  227. ):Icon(
  228. Icons.favorite,
  229. color: Colors.black,
  230. size: 35.0,
  231. ),
  232. title: Text(
  233. 'Favorites',
  234. style: new TextStyle(
  235. color: Colors.white,
  236. fontSize: 0.0,
  237. height: 0.0,
  238. ),
  239. ),
  240. ),
  241. BottomNavigationBarItem(
  242. icon: i==3?Icon(
  243. Icons.person,
  244. color: Color(0xff70E0EF),
  245. size: 35.0,
  246. ):Icon(
  247. Icons.person,
  248. color: Colors.black,
  249. size: 35.0,
  250. ),
  251. title: Text(
  252. 'Profile',
  253. style: new TextStyle(
  254. color: Colors.white,
  255. fontSize: 0.0,
  256. height: 0.0,
  257. ),
  258. ),
  259. ),
  260. ],
  261. type: BottomNavigationBarType.fixed,
  262. currentIndex: i,
  263. onTap: (int index) {
  264. setState((){
  265. i = index;
  266. });
  267. },
  268. ),
  269. ),
  270. ],
  271. );
  272. }
  273. }
Add Comment
Please, Sign In to add comment