Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. void main () => runApp(MyApp());
  3. class MyApp extends StatelessWidget{
  4. @override
  5. Widget build(BuildContext context){
  6. return MaterialApp(
  7. title: 'Junjie Chen',
  8. theme: ThemeData(primarySwatch: Colors.purple),
  9. home: MyhomePage(title:'Jerry Chen-home'),
  10. );
  11. }
  12. }
  13. class MyhomePage extends StatefulWidget {
  14. MyhomePage({Key key, this.title}):super (key:key);
  15. final String title;
  16. @override
  17. _MyhomePageState createState () => _MyhomePageState();
  18. }
  19. class _MyhomePageState extends State<MyhomePage>{
  20. @override
  21. Widget build (BuildContext context){
  22. print('i am here ' + widget.title);
  23. return Scaffold(
  24. appBar: AppBar(
  25. title: Text (widget.title),
  26. ),
  27. body: Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment:
  28. MainAxisAlignment.spaceEvenly,
  29. children: <Widget>[
  30. whatgoseonrows ('Cars', 'Honda', 'Nissan'),
  31. whatgoseonrows ('Laptops ', 'IBM', 'Mac'),
  32. whatgoseonrows ('Planes', 'Boeing', 'Airbus'),
  33. // Junjie chen
  34. ],
  35. ) );
  36. }
  37. }
  38. //Junjie chen
  39. class whatgoseonrows extends StatelessWidget{
  40. final String first, second, third;
  41. const whatgoseonrows (this.first,this.second,this.third);
  42. @override
  43. Widget build (BuildContext context){
  44. return Row(children: <Widget>[
  45. Expanded (child: Text(first + ':', textAlign: TextAlign.center,),),
  46. Expanded (child: Text(second, textAlign: TextAlign.center,),),
  47. Expanded (child: Text(third, textAlign: TextAlign.center,),),
  48. ],);
  49. } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement