Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:dropdown/main.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/rendering.dart';
- import 'package:flutter/services.dart';
- import 'package:http/http.dart' as http;
- import 'dart:async';
- import 'dart:convert';
- class Lihat extends StatefulWidget {
- @override
- _LihatState createState() => _LihatState();
- }
- class _LihatState extends State<Lihat> {
- var data;
- TextEditingController controllerCari = new TextEditingController();
- Future cariData(){
- final response = http.get('https://rsudenisa736.000webhostapp.com/json_get.php?norm='+controllerCari.text);
- return response;
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: new AppBar(
- title: new Text("Lihat Data"),
- ),
- body: new Container(
- child : new Column(
- children: <Widget>[
- new TextField(
- controller: controllerCari,
- decoration: new InputDecoration(
- hintText: "Cari Data"
- ),
- ),
- new RaisedButton(
- onPressed: ()
- async{
- final response = await cariData();
- setState(() {
- data = response;
- });
- },
- child: const Text("Cari DATA"),
- textColor: Colors.blue,
- ), data == null ? Container() : Container(
- child: Text(data[0]["id_pasien"]),
- ),
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement