Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.60 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. import './utils/TextStyles.dart' as textStyles;
  4.  
  5. class CityScreen extends StatefulWidget {
  6.   @override
  7.   _CityScreenState createState() => _CityScreenState();
  8. }
  9.  
  10. class _CityScreenState extends State<CityScreen> {
  11.   TextEditingController _cityNameController = TextEditingController();
  12.   final snackBar = SnackBar(content: Text('Yay! A SnackBar!'));
  13.  
  14.   @override
  15.   Widget build(BuildContext context) {
  16.     return Scaffold(
  17.       appBar: AppBar(
  18.         title: Text('City Search'),
  19.         centerTitle: true,
  20.         backgroundColor: Colors.green,
  21.       ),
  22.       body: Container(
  23.         alignment: Alignment.topCenter,
  24.         margin: EdgeInsets.all(10.0),
  25.         child: Column(
  26.           children: <Widget>[
  27.             Text(
  28.               'enter city name',
  29.               style: textStyles.citySearchStyle(),
  30.             ),
  31.             TextField(
  32.               controller: _cityNameController,
  33.               decoration: InputDecoration(
  34.                   labelText: 'city name', hintText: 'enter city name duh....'),
  35.             ),
  36.             Padding(
  37.               padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0),
  38.               child: Container(
  39.                 child: RaisedButton(
  40.                   child: Text(
  41.                     'Search',
  42.                     style: textStyles.searchStyle(),
  43.                   ),
  44.                   onPressed: () => Scaffold.of(context).showSnackBar(snackBar),
  45.                   color: Colors.green,
  46.                 ),
  47.               ),
  48.             )
  49.           ],
  50.         ),
  51.       ),
  52.     );
  53.   }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement