Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[ABCD2021Winter]Flutterアプリ開発実践

 [ABCD2021Winter]Flutterアプリ開発実践

ABCD 2021 Winterの「Flutterアプリ開発実践」のセッション資料です。

#abcd2021w #androidjp #flutterjp

Kenichi Kambara

December 11, 2021
Tweet

More Decks by Kenichi Kambara

Other Decks in Technology

Transcript

  1. About me •Mobile App Development •Speeches (e.g. 9 International confs.)

    •Writings (e.g. 6 Dev Books) •[Of fi cial] Evangelist at NTT TechnoCross •[Private] iplatform.org ਆݪɹ݈Ұ (@korodroid)
  2. Tips 1. ϥΠϒςϯϓϨʔτͷ׆༻ class MainPage extends StatelessWidget { @override Widget

    build(BuildContext context) { return Container(); } } //Before: ΢ΟδΣοτΛશͯखॻ͖  //After: stless/stful/stanim+[Tab]Ωʔ
  3. Tips 3. FlutterGenͷ׆༻ ΞηοτɾϑΥϯτɾΧϥʔ౳ͷ؅ཧࢧԉ // Before class MainPage extends StatelessWidget

    { @override Widget build(BuildContext context) { return Image.asset("assets/images/chara1.png"); } } // After  ref. FlutterGen: https://github.com/FlutterGen/ fl utter_gen
  4. Widget _getKokkiImage() { return Stack( children: [ Assets.images.kokkiEn.image( height: 80.0,

    ), Assets.images.imgKokkiLeftl.image( height: 80.0, ), Assets.images.imgSpeak.image( height: 24, ), ], ); ref. Stack: https://api. fl utter.dev/ fl utter/widgets/Stack-class.html Step2. ը૾ͷॏͶ߹Θͤ 
  5. Step3. Ґஔ߹Θͤ //Before Widget _getKokkiImage() { return Stack( children: [

    Assets.images.kokkiEn.image( height: 80.0, ), Assets.images.imgKokkiLeftl.image( height: 80.0, ), Assets.images.imgSpeak.image( height: 24, ), ], ); 
  6. // After Widget _getKokkiImage() { return Stack( children: [ Assets.images.kokkiEn.image(

    height: 80.0, ), Assets.images.imgKokkiLeftl.image( height: 80.0, ), Positioned( left: 4.0, top: 60.0, child: Assets.images.imgSpeak.image( height: 24, ), ), ), ], ); } Step3. ϨΠΞ΢τˍҐஔ߹Θͤ 
  7. ྫ. GetXΛ༻͍ͨঢ়ଶ؅ཧ  ൺֱతγϯϓϧʹར༻Մೳ // Before Text(‘Χ΢ϯλʔ’), Text("$count"), // After

    class MainController extends GetxController { var count = 0.obs; increment() => count++; } [View]main_view.dart [Controller]main_contoroller.dart // After final MainController c = Get.put(MainController()); Text(‘Χ΢ϯλʔ’), Obx(() => Text(“${c.count}”)),
  8. GetXͷศརػೳ  ͦͷଞʹ΋ଟ͘ͷศརػೳ Get.to(NextScreen()); Get.toNamed(‘/details'); Get.back(); ը໘ભҠ(ൈਮ) Get.snackbar('͓஌Βͤ', ‘৽ணΫʔϙϯ͕͋Γ·͢ɻ'); Get.defaultDialog(

    title: "֬ೝ", content: Text("ࠓ͙͢ɺϢʔβొ࿥͠·͔͢ʁ"), confirm: TextButton( child: Text("Ok"), onPressed: () => print("OK࣌ͷॲཧ"), )); ϢʔςΟϦςΟ(ൈਮ) ※↑Ҏ֎ʹ΋͞·͟·ͳػೳ͕ఏڙ͞Ε͍ͯ·͢ɻ
  9.  Please let me know if you have any requests

    
 such as technical speeches, technical writings and so on. Facebook:http://fb.com/kanbara.kenichi Twitter:@korodroid LinkedIn:http://www.linkedin.com/in/korodroid Thank you so much