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

20210219 Flutterに入門してみた

Kei Ito
February 19, 2021

20210219 Flutterに入門してみた

Kei Ito

February 19, 2021
Tweet

More Decks by Kei Ito

Other Decks in Programming

Transcript

  1. ൺֱ 'MVUUFS 3FBDU/BUJWF 9BNBSJO ݴޠ %BSU +BWF4DSJQU $ "1* ಠࣗ

    ಠࣗ ಠࣗ  XSBQQFS 6* ಠࣗ ωΠςΟϒ ωΠςΟϒ ։ൃ؀ڥ "OESPJE4UVEJP 74$PEF ͳΜͰ΋ 7JTVBM4UVEJP
  2. 'MVUUFSͷجຊ w એݴܕͷ6* w 8JEHFUͷ֊૚ߏ଄ w ϨΠΞ΢τ΋8JEHFUͱͯ͠૊Έ্͍͛ͯ͘ Widget _buildMoon(...) {

    return Container( child: AspectRatio( aspectRatio: 1, child: CustomPaint( painter: MoonPainter(...), ), ), ); }
  3. ྫʣҐஔ৘ใऔಘ import 'package:location/location.dart'; Future<LocationData> _getLocationData() async { Location location =

    Location(); bool serviceEnabled = await location.serviceEnabled(); if (!serviceEnabled) { serviceEnabled = await location.requestService(); if (!serviceEnabled) { return null; } } PermissionStatus permissionGranted = await location.hasPermission(); if (permissionGranted == PermissionStatus.denied) { permissionGranted = await location.requestPermission(); if (permissionGranted != PermissionStatus.granted) { return null; } } return await location.getLocation(); }
  4. λϒϨοτʢBEBQUJWFʣ w ը໘αΠζΛΈͯࣗલͰௐ੔͢Δඞཁ͋Γ LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) {

    if (constraints.maxWidth < constraints.maxHeight) { return _portraitLayout(moonBox, dataTableBox); } else { return _landscapeLayout(moonBox, dataTableBox); } } )