rajath_pai

ninja18 Using List

Jul 30th, 2021
875
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(MaterialApp(
  4.       home: QuoteList(),
  5.     ));
  6.  
  7. class QuoteList extends StatefulWidget {
  8.   @override
  9.   _QuoteListCardState createState() => _QuoteListCardState();
  10. }
  11.  
  12. class _QuoteListCardState extends State<QuoteList> {
  13.  
  14.   List<String> quotes = [
  15.     'Dont get mad, get even',
  16.     'I have nothing to loose',
  17.     'The truth is rarely pure and never simple'
  18.   ];
  19.  
  20.   Widget build(BuildContext context) {
  21.     return Scaffold(
  22.       backgroundColor: Colors.grey[200],
  23.       appBar: AppBar(
  24.         title: Text('Quote'),
  25.         centerTitle: true,
  26.         backgroundColor: Colors.redAccent,
  27.       ),
  28.       body : Column(
  29.         children : quotes.map((quote) => Text(quote)).toList(),
  30.       ),
  31.     );
  32.   }
  33. }
  34.  
RAW Paste Data