2020의 게시물 표시

flutter 에서 이미지 넣어는데 반영이 안되는 경우 /정중앙에 타이틀

flutter 에서 이미지 넣어는데 반영이 안되는 경우 assets: - images/ - images/common/ 새로 고침 및 재기동 한다, AppBar headerNav({String title}) { return AppBar( title: new Text( '타이틀', textAlign: TextAlign.center, // style: new TextStyle(fontSize: 20.0, color: Colors.white), style: TextStyle(color: Colors.white, fontSize: 22, fontFamily: "NanumGothic", fontWeight: FontWeight.w700, ), ), centerTitle: true, // 정중앙에 타이틀 backgroundColor: Color(0xff324bca), leading: Padding( padding: const EdgeInsets.all(8.0), child: IconButton( icon: Image.asset( "images/common/menu_icon.png", color: Colors.white, ), onPressed: () {}, ), ), actions: [ IconButton( icon: Image.asset( "images/common/logo.png", color: Colors.white, ), onPressed: () {}, ), ], );

flutter comma intl

  import 'package:flutter/material.dart' ; import 'package:intl/intl.dart' show NumberFormat ; // 전역 변수 class Common { // static String localcontextUrl="http://192.168.0.8:8080"; static String contextUrl = "http://192.168.0.8:8080" ; // 일반적인 alert 창 제어 static void Alert (BuildContext context , String titles , String message) { var alert = new AlertDialog ( title: new Text (titles) , content: Container ( child: Row ( children: <Widget>[ Text (message)] , ) , ) , actions: <Widget>[ new FlatButton ( onPressed: () => Navigator. pop (context) , child: Text ( " 확인 " , style: TextStyle (color: Colors. black ) , )) ] , ) ; showDialog( context: con...

flutter json 처리

json data 처리 하는 클래스를  여러군데 선언 하고  import하는 경우 다른 이름으로 사용 하여야 한다. 기존의 return type을 사용 하는 경우도 생각을 해 볼 수 있다.  {     "easyInfo": {         "diff_amt": -1233280,         "with_cust": 0,         "tr_dt": "20201213",         "exp_amt": 1233280,         "amt": 1633000,         "exp_dt": "20201231",         "exp_sum": 21526436,         "hold_amt": 0     } } 클래스안에서 변수명이 일치 하면 error  발생 class Maps { EasyInfo easyInfo ; BizfundInfo bizfundInfo ; Maps({ this . easyInfo , this . bizfundInfo }) ; Maps. fromJson (Map<String , dynamic > json) { easyInfo = json[ 'easyInfo' ] != null ? new EasyInfo . fromJson (json[ 'easyInfo' ]) : null; bizfundInfo = json[ 'bizfundInfo' ] != null ? new BizfundInfo . fromJson (json[ 'bizfundInfo' ]) : null; } Map<St...
{     "message": "",     "flag": "",     "errorFlag": "",     "temp": "",     "temp1": "",     "temp2": "",     "count": "",     "map": {         "easyInfo": {             "exp_amt": 10000,             "exp_sum": 10000,             "amt": 10000,             "exp_dt": "20201215"         }     } }  class PostData { String message; String flag; String errorFlag; String temp; String temp1; String temp2; String count; Map map; PostData( { this .message, this .flag, this .errorFlag, this .temp, this .temp1, this .temp2, this .count, this .map}); PostData.fromJson( Map < String , dynamic > json) { message = json[ 'message' ]; flag = json[ 'flag' ]; ...

flutter error 발생시 해결 방안 --

  Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences) Run 'flutter clean' Run 'flutter pub get' Delete the app from the emulator  새로운 플러그인을 사용 하여 발생 하는 경우 초기화 setting 을 해야한다. A RenderFlex overflowed by 283 pixels on the bottom. --->  return new Scaffold ( resizeToAvoidBottomPadding: false, resizeToAvoidBottomInset : false , The relevant error-causing widget was:   TextFormField -->  An InputDecorator, which is typically created by a TextField, cannot have an unbounded width. -- > TextField   에 특정 너비를 제공해야합니다 간단히   width   를 제공하십시오.  당신의   Container   에서  또는 당신의   Column   를 포장  와이즈 비즈 . Container ( width : 100 , // do it in both Container child : TextField (), ),

flutter post 방식으로 서버 통신 @RequestBody 사용을 해야 하는 경우

  Future<Post> RestApi_Post () async { Map<String , dynamic > queryJson = { "login_id" : "123456789" , "login_pw" : "1234" } ; var bodyEncoded = json.encode(queryJson) ; http.Response response = await http.post( Uri. encodeFull ( 'http://192.168.0.8:8080/Login/signIn' ) , headers: <String , String>{ HttpHeaders. contentTypeHeader : 'application/json' , HttpHeaders. acceptHeader : '*' // "Accept": "application/json", // "Content-Type": "application/x-www-form-urlencoded" } , body: json.encode(queryJson) , // encoding: Encoding.getByName("utf-8"), ) ; print( "jsonEncode(queryJson) sss==" + response.toString()) ; print( "jsonEncode(queryJson) sss==" + json.encode(queryJson).toString()) ; Map<String , dynamic > responseBody = jsonDecode(response. body ) ;...

onPressed FutureBuilder 사용 하기 위해서

  onPressed: () async { var result = await fetchPost() ; print( 'In Builder===' +result. id .toString()) ; if (result. id .toString()== '2' ){ Navigator. pushNamed (context , '/jangbu_m_01' ) ; } else { print( "ssssssssss=====" +result. title .toString()) ; } ;

flutter route

  플러터에서 페이지 UI 개념은 라우트(route)로 정의하고 있다. 라우트 생성과 이동은 사용자 동작 시나리오와 관련이 있어 매우 중요하다. 라우트(route)는 안드로이드 네이티브 코드의 액티비티(Activity)와 iOS 네이티브 코드의 뷰컨트롤러(ViewController)와 대응되는 개념이다. 라우트의 기본 구성과 동작 원리에 대해서 알아보자. 사용자에게는 페이지(Page) 개념으로 익숙한 위와 같은 예시 화면이 route 단위로 보면 되며, 대화상자(Dialog) 등은 route 개념으로 볼 수 없다. route 내에는 Appbar나 기타 페이지를 구성하는 요소들이 하위 위젯(widget)으로 포함될 수 있다. 라우트(route)의 특징으로는 UI 상으로 뒤로가기 아이콘이 자동으로 생성된다. (위 그림의 item 2) 뒤로가기 아이콘은 휴대폰의 back키와 상호작용하도록 자동설정된다. 위의 Page1에서 뒤로가기 버튼이 없는 이유는 Page1이 홈화면으로 지정되기 때문에 뒤로가기 아이콘이 생성되지 않는다. named route를 통해 화면 관리하기 Navigate with named routes https://flutter.dev/docs/cookbook/navigation/named-routes 만약 여러 곳에서 같은 화면으로 navigate 해야 할 때 매번 Route 코드를 추가해야 하는 중복이 발생할 수 있습니다. 이 문제를 해결해주는 게 “named route"입니다. named route로 navigate를 하려면 Navigator.pushNamed()를 이용해야 합니다. initialRoute 속성을 사용할 때는 home 속성을 사용하지 말아야 합니다.