From 29627aa0c47ee0611575c62a8a6800a2d4fa9a3c Mon Sep 17 00:00:00 2001 From: NLOG Date: Sun, 4 Oct 2020 21:04:50 +0900 Subject: [PATCH] =?UTF-8?q?Release=20v0.2.4,=20=ED=95=99=EA=B5=90=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20API=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 282 ++++++++++++++++++++++++++---------------------- lib/school.dart | 4 +- pubspec.yaml | 2 +- 3 files changed, 154 insertions(+), 134 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 1777942..c6bc56d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -55,7 +55,16 @@ class MyApp extends StatelessWidget { class MainPage extends StatefulWidget { JagaJindanData data = - JagaJindanData("", "", "", "", "", false, false, false, false); + JagaJindanData( + "", + "", + "", + "", + "", + false, + false, + false, + false); TextEditingController nameController = TextEditingController(), birthdayController = TextEditingController(), schoolController = TextEditingController(), @@ -89,7 +98,9 @@ class MainPage extends StatefulWidget { class _MainPageState extends State { final _formKey = GlobalKey(); - String _edu = "서울특별시", _school = "1", _select_school_code = ""; + String _edu = "서울특별시", + _school = "1", + _select_school_code = ""; List _schools = []; TextEditingController searchSchoolController; @@ -162,15 +173,16 @@ class _MainPageState extends State { children: [ Text("인증 정보 입력", style: TextStyle( - //color: Colors.black, - fontSize: Theme.of(context) + //color: Colors.black, + fontSize: Theme + .of(context) .textTheme .headline4 .fontSize)), new Padding(padding: EdgeInsets.only(bottom: 50)), TextFormField( decoration: - const InputDecoration(hintText: "이름을 입력하세요."), + const InputDecoration(hintText: "이름을 입력하세요."), validator: (value) { if (value.isEmpty) { return "이름을 입력하세요."; @@ -232,11 +244,11 @@ class _MainPageState extends State { Icons.keyboard_arrow_down), items: EDU_LIST.entries .map< - DropdownMenuItem< - String>>((e) => - DropdownMenuItem( - child: Text(e.key), - value: e.key)) + DropdownMenuItem< + String>>((e) => + DropdownMenuItem( + child: Text(e.key), + value: e.key)) .toList(), onChanged: (String value) { _setState(() { @@ -264,12 +276,12 @@ class _MainPageState extends State { } .entries .map< - DropdownMenuItem< - String>>((e) => - DropdownMenuItem( - child: Text(e.value), - value: e.key, - )) + DropdownMenuItem< + String>>((e) => + DropdownMenuItem( + child: Text(e.value), + value: e.key, + )) .toList(), onChanged: (String value) { _setState(() { @@ -288,13 +300,13 @@ class _MainPageState extends State { Row(children: [ new Flexible( child: TextFormField( - decoration: + decoration: const InputDecoration( hintText: - "학교 명을 입력하세요."), - controller: + "학교 명을 입력하세요."), + controller: searchSchoolController, - )), + )), FlatButton( onPressed: () async { var tmp = await getSchoolList( @@ -318,8 +330,8 @@ class _MainPageState extends State { minWidth: 0, height: 0, materialTapTargetSize: - MaterialTapTargetSize - .shrinkWrap, + MaterialTapTargetSize + .shrinkWrap, padding: EdgeInsets.all(3), ) ]), @@ -336,13 +348,13 @@ class _MainPageState extends State { Icons.keyboard_arrow_down), items: _schools .map< - DropdownMenuItem< - String>>((school) => - DropdownMenuItem( - child: - Text(school.name), - value: school.code, - )) + DropdownMenuItem< + String>>((school) => + DropdownMenuItem( + child: + Text(school.name), + value: school.code, + )) .toList(), onChanged: (String value) { _setState(() { @@ -395,7 +407,7 @@ class _MainPageState extends State { minWidth: 0, height: 0, materialTapTargetSize: - MaterialTapTargetSize.shrinkWrap, + MaterialTapTargetSize.shrinkWrap, padding: EdgeInsets.all(3), ), ], @@ -405,7 +417,7 @@ class _MainPageState extends State { child: TextFormField( keyboardType: TextInputType.number, decoration: - const InputDecoration(hintText: "비밀번호를 입력하세요."), + const InputDecoration(hintText: "비밀번호를 입력하세요."), obscureText: true, validator: (value) { if (value.length != 4) { @@ -449,7 +461,7 @@ class _MainPageState extends State { Navigator.of(context).pop(); this.widget.data.password = ""; this.widget.passwordController.text = - ""; + ""; setState(() { this.widget.data.force = true; @@ -547,114 +559,122 @@ class _MainPageState extends State { builder: (BuildContext context) { return StatefulBuilder( builder: (context, StateSetter _setState) { - if (!first) { - http - .get( + if (!first) { + http + .get( "https://api.github.com/repos/eduro-hcs/jaga_jindan/releases/latest") - .then((data) { - try { - _setState(() { - newVer = jsonDecode(data.body)["tag_name"]; - newVer = newVer.substring(1); + .then((data) { + try { + _setState(() { + newVer = + jsonDecode(data.body)["tag_name"]; + newVer = newVer.substring(1); + }); + } catch (e) { + newVer = "(error)"; + } }); - } catch (e) { - newVer = "(error)"; + first = true; } - }); - first = true; - } - return AlertDialog( - title: Text('설정 및 정보'), - content: SingleChildScrollView( - child: ListBody( - children: [ - CheckboxListTile( - contentPadding: EdgeInsets.zero, - title: const Text('자가진단 결과 알림으로 받기'), - value: this.widget.data.useNotification, - onChanged: (bool value) { - _setState(() { - this.widget.data.useNotification = value; - this.widget.writeJSON(); - }); - }), - Divider( - color: Colors.black38, - height: 50, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row(children: [ - Text("개발자: "), - InkWell( - child: Text( - "엔로그 (nnnlog)", - style: TextStyle( - color: Colors.blue, - decoration: - TextDecoration.underline), + return AlertDialog( + title: Text('설정 및 정보'), + content: SingleChildScrollView( + child: ListBody( + children: [ + CheckboxListTile( + contentPadding: EdgeInsets.zero, + title: const Text( + '자가진단 결과 알림으로 받기'), + value: this.widget.data + .useNotification, + onChanged: (bool value) { + _setState(() { + this.widget.data + .useNotification = value; + this.widget.writeJSON(); + }); + }), + Divider( + color: Colors.black38, + height: 50, + thickness: 1, + indent: 0, + endIndent: 0, ), - onTap: () => launch( - "https://github.com/nnnlog/"), - ) - ]), - Row(children: [ - Text("Repository: "), - InkWell( - child: Text( - "jaga_jindan", - style: TextStyle( - color: Colors.blue, - decoration: + Row(children: [ + Text("개발자: "), + InkWell( + child: Text( + "엔로그 (nnnlog)", + style: TextStyle( + color: Colors.blue, + decoration: TextDecoration.underline), - ), - onTap: () => launch( - "https://github.com/eduro-hcs/jaga_jindan"), - ) - ]), - Row(children: [ - Text("앱 버전: "), - InkWell( - child: Text( - appVer, - style: TextStyle( - color: Colors.blue, - decoration: + ), + onTap: () => + launch( + "https://github.com/nnnlog/"), + ) + ]), + Row(children: [ + Text("Repository: "), + InkWell( + child: Text( + "jaga_jindan", + style: TextStyle( + color: Colors.blue, + decoration: TextDecoration.underline), - ), - onTap: () => launch( - "https://github.com/eduro-hcs/jaga_jindan/releases/tag/v${appVer}"), - ) - ]), - Row(children: [ - Text("최신 버전: "), - InkWell( - child: Text( - newVer, - style: TextStyle( - color: Colors.blue, - decoration: + ), + onTap: () => + launch( + "https://github.com/eduro-hcs/jaga_jindan"), + ) + ]), + Row(children: [ + Text("앱 버전: "), + InkWell( + child: Text( + appVer, + style: TextStyle( + color: Colors.blue, + decoration: TextDecoration.underline), - ), - onTap: () => launch( - "https://github.com/eduro-hcs/jaga_jindan/releases/tag/v${newVer}"), - ) - ]), + ), + onTap: () => + launch( + "https://github.com/eduro-hcs/jaga_jindan/releases/tag/v${appVer}"), + ) + ]), + Row(children: [ + Text("최신 버전: "), + InkWell( + child: Text( + newVer, + style: TextStyle( + color: Colors.blue, + decoration: + TextDecoration.underline), + ), + onTap: () => + launch( + "https://github.com/eduro-hcs/jaga_jindan/releases/tag/v${newVer}"), + ) + ]), + ], + ), + ), + actions: [ + FlatButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('닫기'), + ), ], - ), - ), - actions: [ - FlatButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('닫기'), - ), - ], - ); - }); + ); + }); }, ); }, diff --git a/lib/school.dart b/lib/school.dart index cb75dd0..4a47805 100644 --- a/lib/school.dart +++ b/lib/school.dart @@ -29,11 +29,11 @@ Future> getSchoolList( String name, String region, String schulCrseScCode) async { try { var res = jsonDecode((await http.get( - Uri.https("hcs.eduro.go.kr", "/school", { + Uri.https("hcs.eduro.go.kr", "/v2/searchSchool", { 'lctnScCode': EDU_LIST[region], 'schulCrseScCode': schulCrseScCode, 'orgName': name, - 'currentPageNo': '1' + 'loginType': 'school' }))) .body); diff --git a/pubspec.yaml b/pubspec.yaml index 9ebf5dd..88c7aba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: 자가진단 자동화 앱 publish_to: 'none' -version: 0.2.3 +version: 0.2.4 environment: sdk: ">=2.7.0 <3.0.0"