Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.79 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(MyApp());
  4.  
  5. class MyApp extends StatelessWidget {
  6.  
  7.   Container MyArticles(String imagefile, String header, String subheafer){
  8.     return Container(
  9.                 width: 100.0,
  10.                 child: Card(
  11.                   child: Wrap(
  12.                     children: <Widget>[
  13.                       //Image.asset('assets/aries_120.jpg'),
  14.                       ListTile(
  15.                         title: Text(header),
  16.                         subtitle: Text(subheafer)
  17.                         )
  18.                     ],
  19.                   ),
  20.                 ),
  21.               );
  22.   }
  23.  
  24.   @override
  25.   Widget build(BuildContext context) {
  26.     return MaterialApp(
  27.       //debugShowCheckedModeBanner: false,
  28.       title: 'Flutter Demo',
  29.       theme: ThemeData(
  30.         primaryColor: Color(0xff622F72)
  31.       ),
  32.       home: Scaffold(
  33.         appBar: AppBar(
  34.           title: Text('Scroll View - Horizontal',
  35.           style: TextStyle(
  36.             color: Colors.white
  37.           ),)
  38.         ),
  39.         body: Container(
  40.             margin: EdgeInsets.symmetric(vertical: 20.0),
  41.             height: 200,
  42.             child: ListView(
  43.               scrollDirection: Axis.horizontal,
  44.               children: <Widget>[
  45.                 MyArticles('some_img_file', 'header1', 'subheader1'),
  46.                 MyArticles('some_img_file', 'header2', 'subheader2'),
  47.                 MyArticles('some_img_file', 'header3', 'subheader3'),
  48.                 MyArticles('some_img_file', 'header4', 'subheader4'),
  49.                 MyArticles('some_img_file', 'header5', 'subheader5'),
  50.                 MyArticles('some_img_file', 'header6', 'subheader6')                                
  51.               ],
  52.             ),
  53.           )
  54.       )
  55.     );
  56.   }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement