Open HosseinBabriani opened 5 years ago
This id my code : import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'User.dart'; import 'dart:convert'; import 'package:autocomplete_textfield/autocomplete_textfield.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }
class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title;
@override _MyHomePageState createState() => _MyHomePageState(); }
class _MyHomePageState extends State
//https://jsonplaceholder.typicode.com/users void getUser() async { try { final response = await http.get("https://jsonplaceholder.typicode.com/users"); if (response.statusCode == 200) { users = loadUser(response.body); setState(() { loading = false; }); } else { print("Error!"); } } catch (e) { print("Error!"); } }
static List
@override void initState() { getUser(); // TODO: implement initState super.initState(); }
Widget row(User user) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
children:
How can iget selected id from autocomplete_textfield ?