AndreiFilea

app

Jan 14th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.40 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:cards/payment_screen.dart';
  3.  
  4. void main() => runApp(MyApp());
  5.  
  6. class MyApp extends StatelessWidget {
  7. // This widget is the root of your application.
  8. @override
  9. Widget build(BuildContext context) {
  10. return MaterialApp(
  11. title: 'Cards UI',
  12. theme: ThemeData(
  13. primarySwatch: Colors.blue,
  14. ),
  15. home: MyHomePage(title: 'Flutter Demo Home Page'),
  16. );
  17. }
  18. }
  19. class MyHomePage extends StatefulWidget {
  20. MyHomePage({Key key, this.title}) : super(key: key);
  21. final String title;
  22.  
  23. @override
  24. _MyHomePageState createState() => _MyHomePageState();
  25. }
  26.  
  27.  
  28. class Atributes{
  29. final Color colorgrad;
  30. final Color colorgrad2;
  31. Atributes(this.colorgrad,this.colorgrad2);
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. class _MyHomePageState extends State<MyHomePage> {
  40.  
  41. final List<Atributes> atributelist=[
  42. Atributes(Colors.purple,Colors.blue),
  43. Atributes(Colors.black,Colors.yellow),
  44. Atributes(Colors.green,Colors.yellow),
  45. Atributes(Colors.red,Colors.red),
  46.  
  47. ];
  48.  
  49. final cardtext = new Container(
  50. padding: EdgeInsets.only(top: 110,left: 35,bottom: 0),
  51. child:(
  52. Text('Bank Cards', style: TextStyle(fontSize: 34, fontWeight: FontWeight.bold,color: Colors.white),))
  53.  
  54. );
  55.  
  56.  
  57. final profileimage = new Container(
  58. padding: EdgeInsets.only(top: 110,right: 35),
  59. child: (
  60. CircleAvatar(
  61. radius: 22.0,
  62. backgroundImage: NetworkImage('https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/2020-mclaren-720s-mmp-1-1570642764.jpg?crop=0.577xw:0.789xh;0.337xw,0.158xh&resize=640:*'),)
  63.  
  64. ),
  65. );
  66.  
  67.  
  68. final balancetext = new Container(
  69. padding: EdgeInsets.only(left: 20,bottom: 20,top: 35),
  70. child:(
  71. ListTile(
  72. title: Text('Balance',style: TextStyle(fontSize: 14,fontWeight: FontWeight.normal,color: Colors.grey),textAlign: TextAlign.left,),
  73. subtitle: Text('RON 3969.35',style: TextStyle(fontSize: 18,fontWeight: FontWeight.bold,color: Colors.white),textAlign: TextAlign.left,),
  74.  
  75. )
  76. ),
  77. );
  78.  
  79.  
  80. String link1='https://i.imgur.com/h2cmNtk.png?1';
  81. /*
  82. Widget cardscrolling(BuildContext context,int index){
  83.  
  84.  
  85. return new Container(
  86. margin: EdgeInsets.symmetric(vertical: 10.0),
  87. padding: EdgeInsets.only(left: 20,right: 20),
  88.  
  89. height: 400,
  90.  
  91. child: ListView(
  92. scrollDirection: Axis.horizontal,
  93. children: <Widget>[
  94. new GestureDetector(
  95. //splashColor: Colors.green,
  96. onTap: (){
  97. Navigator.push(context, MaterialPageRoute(builder: (context) =>
  98. PaymentScreenView()
  99. ));
  100.  
  101. },
  102. child: (
  103. Container(
  104. height: 400,
  105. width: 225,
  106. margin: EdgeInsets.only(right: 20,left: 20),
  107. decoration: BoxDecoration(
  108. borderRadius: new BorderRadius.all(const Radius.circular(10)),
  109. gradient: LinearGradient(
  110. begin: Alignment.topLeft,
  111. end: Alignment.bottomRight,
  112. colors: [atribute.colorgrad,Colors.lightBlueAccent,atribute.colorgrad2]
  113. )
  114. ),
  115. child: (
  116. Image(
  117. image: NetworkImage(link1),
  118. )
  119. ),
  120. )
  121. ),
  122. ),
  123. GestureDetector(
  124. child: Container(
  125. height: 400,
  126. width: 225,
  127. margin: EdgeInsets.only(right: 20,left: 20),
  128. decoration: BoxDecoration(
  129. borderRadius: new BorderRadius.all(const Radius.circular(10)),
  130. gradient: LinearGradient(
  131. begin: Alignment.topLeft,
  132. end: Alignment.bottomRight,
  133. colors: [Colors.grey[900],Colors.limeAccent,Colors.lime]
  134. )
  135. ),
  136. child: (
  137. Image(
  138. image: NetworkImage(link1),
  139. )
  140. ),
  141. ),
  142. ),
  143. Container(
  144. height: 400,
  145. width: 225,
  146. margin: EdgeInsets.only(right: 20,left: 20),
  147. decoration: BoxDecoration(
  148. borderRadius: new BorderRadius.all(const Radius.circular(10)),
  149. gradient: LinearGradient(
  150. begin: Alignment.topLeft,
  151. end: Alignment.bottomRight,
  152. colors: [Colors.green,Colors.yellow]
  153. )
  154. ),
  155. child: (
  156. Image(
  157. image: NetworkImage(link1),
  158.  
  159. )
  160. ),
  161.  
  162. ),
  163. Container(
  164. height: 400,
  165. width: 225,
  166. margin: EdgeInsets.only(right: 20,left: 20),
  167. decoration: BoxDecoration(
  168. borderRadius: new BorderRadius.all(const Radius.circular(10)),
  169. gradient: LinearGradient(
  170. begin: Alignment.topLeft,
  171. end: Alignment.bottomRight,
  172. colors: [Colors.orange,Colors.red]
  173. )
  174. ),
  175. child: (
  176. Image(
  177. image: NetworkImage(link1),
  178. )
  179. ),
  180. ),
  181. cardimage(context),
  182. ],
  183. ),
  184. );
  185.  
  186. }
  187. */
  188. Widget cardimage(BuildContext context){
  189. return
  190. GestureDetector(
  191. onTap: (){
  192. Navigator.push(context, MaterialPageRoute(builder: (context) =>
  193. PaymentScreenView()
  194. ));
  195. },
  196. child:(
  197. Container(
  198. height: 400,
  199. width: 225,
  200. margin: EdgeInsets.only(right: 20,left: 20),
  201. decoration: BoxDecoration(
  202. borderRadius: new BorderRadius.all(const Radius.circular(10)),
  203. gradient: LinearGradient(
  204. begin: Alignment.topLeft,
  205. end: Alignment.bottomRight,
  206. colors: [Colors.pink,Colors.grey]
  207. )
  208. ),
  209. child: (
  210. Image(
  211. image: NetworkImage(link1),
  212. )
  213. ),
  214. )
  215. )
  216. );
  217. }
  218.  
  219. Widget buildCardScroll(BuildContext context, int index){
  220.  
  221. final atribute=atributelist[index];
  222.  
  223. return Container(
  224. margin: EdgeInsets.symmetric(vertical: 10.0),
  225. padding: EdgeInsets.only(left: 20,right: 20),
  226.  
  227. height: 400,
  228.  
  229. child: ListView(
  230. scrollDirection: Axis.horizontal,
  231. children: <Widget>[
  232.  
  233.  
  234. new GestureDetector(
  235. onTap: (){
  236. Navigator.push(context, MaterialPageRoute(builder: (context) =>
  237. PaymentScreenView()
  238. ));
  239.  
  240. },
  241. child: (
  242. Container(
  243. height: 400,
  244. width: 225,
  245. margin: EdgeInsets.only(right: 20,left: 20),
  246. decoration: BoxDecoration(
  247. borderRadius: new BorderRadius.all(const Radius.circular(10)),
  248. gradient: LinearGradient(
  249. begin: Alignment.topLeft,
  250. end: Alignment.bottomRight,
  251. colors: [atribute.colorgrad,atribute.colorgrad2]
  252. )
  253. ),
  254. child: (
  255. Image(
  256. image: NetworkImage(link1),
  257. )
  258. ),
  259. )
  260. ),
  261. ),
  262.  
  263. ],
  264. )
  265. );
  266.  
  267.  
  268. }
  269.  
  270. @override
  271. Widget build(BuildContext context) {
  272.  
  273. return Scaffold(
  274. backgroundColor: Colors.black,
  275. body: Column(
  276. //mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  277. children: <Widget>[
  278. Expanded(
  279. child: SingleChildScrollView(
  280. child: Column(
  281. children: <Widget>[
  282. Row(
  283. crossAxisAlignment: CrossAxisAlignment.start,
  284. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  285. children: <Widget>[
  286. cardtext,
  287. profileimage
  288. ],
  289. ),
  290. balancetext,
  291. //for(int inde=0;inde<=1;inde++)
  292.  
  293. //INITIAL CARD SCROLL
  294. //buildCardScroll(context,0)
  295. Container(
  296. margin: EdgeInsets.symmetric(vertical: 10.0),
  297. padding: EdgeInsets.only(left: 20,right: 20),
  298.  
  299. height: 400,
  300.  
  301. child:
  302. ListView.builder(
  303. scrollDirection: Axis.vertical,
  304. itemCount: atributelist.length,
  305. itemBuilder: (BuildContext context,int index)=> buildCardScroll(context,index),
  306. )
  307. )
  308. ],
  309. )
  310. ),
  311. )
  312. ],
  313. )
  314. );
  315. }
  316. }
Add Comment
Please, Sign In to add comment