Submit Search
Upload
GDSC NCU Flutter
•
Download as PPTX, PDF
•
0 likes
•
119 views
N
NCUDSC
Follow
Flutter Workshop Slides
Read less
Read more
Technology
Report
Share
Report
Share
1 of 45
Download now
Recommended
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for Beginners
Jiaxuan Lin
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
Thierry Wasylczenko
Lecture: Vaadin Overview
Lecture: Vaadin Overview
Joonas Lehtinen
Vaadin7 modern-web-apps-in-java
Vaadin7 modern-web-apps-in-java
Joonas Lehtinen
Qt Workshop
Qt Workshop
Johan Thelin
Vaadin7
Vaadin7
Joonas Lehtinen
Vaadin 7
Vaadin 7
Joonas Lehtinen
Vaadin 7
Vaadin 7
Joonas Lehtinen
Recommended
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for Beginners
Jiaxuan Lin
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
Thierry Wasylczenko
Lecture: Vaadin Overview
Lecture: Vaadin Overview
Joonas Lehtinen
Vaadin7 modern-web-apps-in-java
Vaadin7 modern-web-apps-in-java
Joonas Lehtinen
Qt Workshop
Qt Workshop
Johan Thelin
Vaadin7
Vaadin7
Joonas Lehtinen
Vaadin 7
Vaadin 7
Joonas Lehtinen
Vaadin 7
Vaadin 7
Joonas Lehtinen
Android Best Practices
Android Best Practices
Yekmer Simsek
The State of the Veil Framework
The State of the Veil Framework
VeilFramework
Choose flutter
Choose flutter
SamuelAdetunji2
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
Chris Ramsdale
Gwt.create
Gwt.create
Mauricio (Salaboy) Salatino
Das kannste schon so machen
Das kannste schon so machen
André Goliath
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and Tomorrow
Joonas Lehtinen
Internationalizing react apps
Internationalizing react apps
George Bukhanov
Intro to Flutter
Intro to Flutter
Eason Pai
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Paul King
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Robot Media
JBoss World 2010
JBoss World 2010
Chris Ramsdale
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
GITS Indonesia
Cristiano Betta (Betta Works) - Lightweight Libraries with Rollup, Riot and R...
Cristiano Betta (Betta Works) - Lightweight Libraries with Rollup, Riot and R...
Techsylvania
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
node.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Server
David Ruiz
Nodejs Intro Part One
Nodejs Intro Part One
Budh Ram Gurung
Vaadin today and tomorrow
Vaadin today and tomorrow
Joonas Lehtinen
Native Java with GraalVM
Native Java with GraalVM
Sylvain Wallez
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
Hazelcast
LineBot.pptx
LineBot.pptx
NCUDSC
221013 GDSC Kotlin Basics.pptx
221013 GDSC Kotlin Basics.pptx
NCUDSC
More Related Content
Similar to GDSC NCU Flutter
Android Best Practices
Android Best Practices
Yekmer Simsek
The State of the Veil Framework
The State of the Veil Framework
VeilFramework
Choose flutter
Choose flutter
SamuelAdetunji2
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
Chris Ramsdale
Gwt.create
Gwt.create
Mauricio (Salaboy) Salatino
Das kannste schon so machen
Das kannste schon so machen
André Goliath
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and Tomorrow
Joonas Lehtinen
Internationalizing react apps
Internationalizing react apps
George Bukhanov
Intro to Flutter
Intro to Flutter
Eason Pai
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Paul King
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Robot Media
JBoss World 2010
JBoss World 2010
Chris Ramsdale
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
GITS Indonesia
Cristiano Betta (Betta Works) - Lightweight Libraries with Rollup, Riot and R...
Cristiano Betta (Betta Works) - Lightweight Libraries with Rollup, Riot and R...
Techsylvania
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
node.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Server
David Ruiz
Nodejs Intro Part One
Nodejs Intro Part One
Budh Ram Gurung
Vaadin today and tomorrow
Vaadin today and tomorrow
Joonas Lehtinen
Native Java with GraalVM
Native Java with GraalVM
Sylvain Wallez
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
Hazelcast
Similar to GDSC NCU Flutter
(20)
Android Best Practices
Android Best Practices
The State of the Veil Framework
The State of the Veil Framework
Choose flutter
Choose flutter
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
Gwt.create
Gwt.create
Das kannste schon so machen
Das kannste schon so machen
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and Tomorrow
Internationalizing react apps
Internationalizing react apps
Intro to Flutter
Intro to Flutter
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
JBoss World 2010
JBoss World 2010
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Cristiano Betta (Betta Works) - Lightweight Libraries with Rollup, Riot and R...
Cristiano Betta (Betta Works) - Lightweight Libraries with Rollup, Riot and R...
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
node.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Server
Nodejs Intro Part One
Nodejs Intro Part One
Vaadin today and tomorrow
Vaadin today and tomorrow
Native Java with GraalVM
Native Java with GraalVM
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
More from NCUDSC
LineBot.pptx
LineBot.pptx
NCUDSC
221013 GDSC Kotlin Basics.pptx
221013 GDSC Kotlin Basics.pptx
NCUDSC
讓你的人工智慧更智慧 - Developer Student Clubs.pptx
讓你的人工智慧更智慧 - Developer Student Clubs.pptx
NCUDSC
Laravel II - Developer Student Clubs NCU.pdf
Laravel II - Developer Student Clubs NCU.pdf
NCUDSC
20220316 laravel I
20220316 laravel I
NCUDSC
Gdsc is back!
Gdsc is back!
NCUDSC
Artificial intelligence in laboratory medicine clinical decision support-gd...
Artificial intelligence in laboratory medicine clinical decision support-gd...
NCUDSC
GDSC intro
GDSC intro
NCUDSC
NLP補充
NLP補充
NCUDSC
Docker
Docker
NCUDSC
Big Query
Big Query
NCUDSC
Forensics 101 的副本
Forensics 101 的副本
NCUDSC
More from NCUDSC
(12)
LineBot.pptx
LineBot.pptx
221013 GDSC Kotlin Basics.pptx
221013 GDSC Kotlin Basics.pptx
讓你的人工智慧更智慧 - Developer Student Clubs.pptx
讓你的人工智慧更智慧 - Developer Student Clubs.pptx
Laravel II - Developer Student Clubs NCU.pdf
Laravel II - Developer Student Clubs NCU.pdf
20220316 laravel I
20220316 laravel I
Gdsc is back!
Gdsc is back!
Artificial intelligence in laboratory medicine clinical decision support-gd...
Artificial intelligence in laboratory medicine clinical decision support-gd...
GDSC intro
GDSC intro
NLP補充
NLP補充
Docker
Docker
Big Query
Big Query
Forensics 101 的副本
Forensics 101 的副本
Recently uploaded
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
Sandro Moreira
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
WSO2
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
WSO2
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
Remote DBA Services
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
Pixlogix Infotech
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
Christopher Logan Kennedy
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
Samir Dash
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
VictorSzoltysek
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Orbitshub
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
AnitaRaj43
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
WSO2
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
Rustici Software
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
DianaGray10
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Zilliz
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
UiPathCommunity
Recently uploaded
(20)
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
GDSC NCU Flutter
1.
Flutter 從入門到入土 Kevin Xheng @kevinjone25
2.
About Me @idisused • GDSC
Core team • NCtfU 滑水的負責人 • ideaNCU前任受害者 • 程研社長? • MGTCC老屁股 • 資管大三的鹹魚
3.
Flutter Overview 這是啥 ● 由Dart語言撰寫 ●
跨平台 ● skia render ● google的
4.
在Flutter裡
5.
• 不能改變狀態 所有都是final型態 •
build 只跑一次 Widget 遍地都是widget Stateless Widget Stateful Widget • 可以在lifetime中改變狀態 • setState會重複觸發Build
6.
Three Tree yee? Widget
Tree
7.
Three Tree yee? Element Tree 兩種基本型態 ●
ComponentElement ● RenderObjectElement
8.
Three Tree yee? Render
Tree ● 每個節點都是RenderObject,定義了如何去渲染 layout、Size……
9.
有 我有聽懂 大概吧...... 我相信大家現在是
10.
Lab 1. BaseUI
11.
打開你的Flutter Lab 右上角按下去創建新Project 實作開始
12.
照著做 最底下不用填沒關西 創project
13.
讓子彈飛一會 Build Your Project
14.
Hot reload, phone
simulator 接下來是介紹時間 即時看到你code的回饋 反映在模擬器上
15.
檔案結構 Firectory Structure 寫單元測試的地方 dart file所在地 run
android OS run ios OS 添加 dependencies
16.
import 'package:flutter/material.dart'; void main()
{ runApp( const MaterialApp( title: 'Flutter Tutorial', home: MyApp(), ), ); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('idisused'), centerTitle: true, backgroundColor: Colors.grey[900], elevation: 0, ), ); } } 刪掉所有的code 把右邊貼上去 接下來讓我們來看看 ‘從頭’開始第一個UI設計 要長右邊這樣
17.
//看到一個//AppBar的註解接在他後面 body: Padding( padding: const
EdgeInsets.fromLTRB(30, 40, 30, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ const Center( child: CircleAvatar( backgroundImage: AssetImage('assets/star.png'), radius: 50, ), ), Divider( height: 80, thickness: 2, color: Colors.grey[500]), ], ), ), 剛剛你的頭造好了 所以請把身體接在頭 下方 構造你的身體 應該會跟這個差不多
18.
404 not found 圖片? 你會發現你沒有assets
資料夾 所以你需要創一個
19.
在根目錄創建 如下圖 assets folder
然後我們需要把pubspec.yaml的assets取消註解 或是你想要自己寫也可以
20.
頭貼就完成了 上傳圖片 & Hot
reload
21.
Divider(height: 80, thickness: 2, color:
Colors.grey[500]), ##接在上面那個逗點之後 const Text('NAME', style: TextStyle( color: Colors.grey, letterSpacing: 2, fontSize: 18, fontWeight: FontWeight.bold)), const SizedBox(height: 10), Text('Yuan-Xheng', style: TextStyle( color: Colors.amber[300], letterSpacing: 2, fontSize: 25, fontWeight: FontWeight.bold)), 把右邊皆在剛剛的code下方 用完長下面這樣 加點介紹
22.
Divider(height: 80, thickness: 2, color:
Colors.grey[500]), ##接在上面那個逗點之後 const Text('NAME', style: TextStyle( color: Colors.grey, letterSpacing: 2, fontSize: 18, fontWeight: FontWeight.bold)), const SizedBox(height: 10), Text('Kirito', style: TextStyle( color: Colors.amber[300], letterSpacing: 2, fontSize: 25, fontWeight: FontWeight.bold)), 把右邊皆在剛剛的code下方 用完長下面這樣 加點介紹
23.
Text('Yuan-Xheng', style: TextStyle(color: Colors.amber[300],
letterSpacing: 2, fontSize: 25, fontWeight: FontWeight.bold)), ##接在上面那個逗點之後 const SizedBox(height: 30.0), const Text('INTRO', style: TextStyle( color: Colors.grey, letterSpacing: 2, fontSize: 18, fontWeight: FontWeight.bold)), const SizedBox(height: 10), Text('我是一條雜魚', style: TextStyle(color: Colors.amber[300], letterSpacing: 2, fontSize: 25, fontWeight: FontWeight.bold)), const SizedBox(height: 30.0), 把右邊皆在剛剛的code下方 用完長下面這樣 加點介紹cont.
24.
const SizedBox(height: 30.0), ##接在上面那個逗點之後 Row( children:
<Widget>[ const Icon( Icons.email, color: Colors.grey, ), const SizedBox(width: 10), Text( 'fish@example.edu.tw', style: TextStyle( color: Colors.grey[300], fontSize: 18, letterSpacing: 1, ), ) ], ), 把右邊皆在剛剛的code下方 用完長下面這樣 加個聯絡方式
25.
啊我想要更多Widget
26.
然後......
27.
然後
28.
Solutio n
29.
小憩片刻 等下回來......
30.
Lab 2. Easy
Weather App
31.
先幫我去API平台登入
32.
按取得授權碼 然後放著 授權碼會出現在這裡
33.
先再來創個project 一樣的步驟
34.
長的像右邊那樣 新增資料夾和檔案 ● Models 資料夾 ●
pages資料夾 ● services資料夾 ● home.dart ● weather_response.dart ● loading.dart ● weather.dart
35.
報error沒關西 在main.dart裡加 新增路由 import 'pages/home.dart'; import
'pages/loading.dart'; import 'package:flutter/material.dart'; void main() { runApp( MaterialApp( initialRoute: '/', routes: { '/': (context) => const Loading(), //'/home': (context) => const Home(), }, ), ); }
36.
新增在loading.dart 記得在pubspec.yaml裡加flutter spinkit 新增stateful widget import
'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; class Loading extends StatefulWidget { const Loading({Key? key}) : super(key: key); @override State<Loading> createState() => _LoadingState(); } class _LoadingState extends State<Loading> { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return const Scaffold( backgroundColor: Colors.black, body: Center( child: SpinKitRipple( color: Colors.white, size: 100.0, ), )); } }
37.
接下來步驟比較複雜 如果有串接第三方API經驗的同學可以躺平
38.
記得在pubspec.yaml裡加http 然後把Auth Key換成你剛剛拿到的API 授權碼! 然後把Auth
Key換成你剛剛拿到的API 授權碼! 然後把Auth Key換成你剛剛拿到的API 授權碼! 然後package:[你的app名稱]/models 因為很重要所以講三次 更改weather.dart import 'package:flutter/material.dart'; import 'package:http/http.dart'; import 'dart:convert'; import 'package:weatherapp/models/weather_response.dart'; class Weather { String firstStartTime = ''; String firstEndTime = ''; String firstProbability = ''; String secondStartTime = ''; String location = ''; Future<void> getWeather() async { try { Response response = await get(Uri.parse( "https://opendata.cwb.gov.tw/api/v1/rest/datastore/F- D0047- 005?Authorization=[AuthKey]&format=JSON&locationName=%E4%B8%AD%E5%A3 %A2%E5%8D%80&elementName=PoP6h")); WeatherResponse weatherResponse = WeatherResponse.fromJson(json.decode(response.body)); location = weatherResponse.records.locations[0].location[0].locationName; firstStartTime = weatherResponse .records.locations[0].location[0].weatherElement[0].time[0].startTim e .substring(11, 16); firstProbability = weatherResponse.records.locations[0].location[0] .weatherElement[0].time[0].elementValue[0].value; secondStartTime = weatherResponse .records.locations[0].location[0].weatherElement[0].time[1].startTim e .substring(11, 16); } catch (e) { debugPrint('Error: $e'); location = '無法取得資料'; } } }
39.
然後把API網址貼到新網頁上 會出現下圖 把他們全部copy起來 更改weather_response.dart https://www.jsontodart.in/ 到上面這個網址
把json貼上去 轉成dart 貼到weather_response.dart 然後把AutoGenerate的˙class改成WeatherResponse
40.
把code貼在Loading State的Widget裡 記得要import weather.dart 更改loading.dart class
_LoadingState extends State<Loading> { ##接在上面那行之後 String location = 'loading'; void setWeather() async { Weather instance = Weather(); await instance.getWeather(); Navigator.pushReplacementNamed(context, '/home', arguments: { 'location': instance.location, 'firstStartTime': instance.firstStartTime, 'firstProbability': instance.firstProbability, 'secondStartTime': instance.secondStartTime, }); } //放在init state下方 WidgetsBinding.instance!.addPostFrameCallback((_) => setWeather()); import '../services/weather.dart';
41.
先貼一部份 好長好長 更改home.dart import 'package:flutter/material.dart'; class Home
extends StatefulWidget { const Home({Key? key}) : super(key: key); @override State<Home> createState() => _HomeState(); } class _HomeState extends State<Home> { Map<String, dynamic> data = {}; @override Widget build(BuildContext context) { data = Map<String, dynamic>.from( (ModalRoute.of(context)?.settings.arguments ?? {}) as Map<dynamic, dynamic>); bool nightCondition = DateTime.now().hour > 18 && DateTime.now().hour < 8; return Scaffold(); } }
42.
接下來建構主體 把code貼在Scaffold裡 更改home.dart backgroundColor: nightCondition ?
Colors.grey[200] : Colors.grey[900], body: SafeArea( child: Padding( padding: const EdgeInsets.fromLTRB(0, 120, 0, 0), child: Column( children: <Widget>[ const SizedBox(height: 50), Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text(data['location'], style: TextStyle( fontSize: 28, letterSpacing: 2, color: !nightCondition ? Colors.grey[200] : Colors.black, )) ], ), const SizedBox(height: 30), Text( data['firstStartTime'] + '-' + data['secondStartTime'], style: TextStyle( fontSize: 45, color: !nightCondition ? Colors.grey[200] : Colors.grey[900], ), ), const SizedBox(height: 10), Icon( data['firstProbability'] == 0 ? Icons.light_mode : Icons.beach_access, size: 50, color: data['firstProbability'] == 0 ? Colors.amber : Colors.blue), const SizedBox(height: 15), Text(data['firstProbability'] + '%', style: TextStyle( fontSize: 35, letterSpacing: 2, color: !nightCondition ? Colors.grey[200] : Colors.grey[900], )), ], ), ), )
43.
把main.dart的註解拿掉 你就會看到我們未來六小時的天氣預報 取消註解
44.
感謝各位的聆聽 <(_ _)>
45.
回饋表單
Download now