city_pickers 0.0.1 copy "city_pickers: ^0.0.1" to clipboard
city_pickers: ^0.0.1 copied to clipboard

outdated

A new flutter plugin project.

example/lib/main.dart

import 'package:flutter/material.dart';
//import 'dart:async';
//
//import 'package:flutter/services.dart';
import 'package:city_pickers/city_pickers.dart';
import 'package:flutter/cupertino.dart';
void main() => runApp(MyApp());


class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      debugShowCheckedModeBanner: false,
      home: Main(),
    );
  }
}


class Main extends StatefulWidget {
  @override
  _MainState createState() => _MainState();
}

class _MainState extends State<Main> {
  Result _result;

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
  }
  show(context) async {
    Result temp  = await CityPicker.showCityPicker(
      context: context,
      locationCode: '640221',
      height: 400,
    );
    setState(() {
      _result = temp;
    });

  }
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
            child: Column(
              children: <Widget>[
                Text("result: ${_result.toString()}"),
                RaisedButton(
                  onPressed: () {this.show(context);
                  },
                  child: Text("slect"),
                ),
              ],
            )
        ),
      ),
    );
  }
}
87
likes
0
pub points
93%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, lpinyin

More

Packages that depend on city_pickers