Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Mastering the Theming in Flutter
Search
Muhammed Salih Güler
May 14, 2019
Programming
0
75
Mastering the Theming in Flutter
Muhammed Salih Güler
May 14, 2019
Tweet
Share
More Decks by Muhammed Salih Güler
See All by Muhammed Salih Güler
Fluttercon 2023 - Flutter Talk
salihgueler
0
490
AWS Summit Stockholm - Amplify Studio
salihgueler
0
65
Serverlabs Flutter Talk
salihgueler
0
69
What is AWS Amplify - KotlinConf
salihgueler
0
110
Underengineering Contents: Creating Content For Everyone
salihgueler
0
40
How to prepare a proposal to conferences?
salihgueler
1
100
Flutter Study Jam Hannover
salihgueler
0
56
Write your first Flutter application
salihgueler
0
68
What's new for Flutter at I/O 2019
salihgueler
0
45
Other Decks in Programming
See All in Programming
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
140
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
720
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
2.2k
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
940
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.4k
AgentCoreとHuman in the Loop
har1101
5
160
クラウドに依存しないS3を使った開発術
simesaba80
0
220
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
180
Python札幌 LT資料
t3tra
7
1.1k
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
130
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
340
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
490
Featured
See All Featured
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.8k
Why Our Code Smells
bkeepers
PRO
340
58k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
290
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
150
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
360
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
47
Making the Leap to Tech Lead
cromwellryan
135
9.7k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
210
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
210
Balancing Empowerment & Direction
lara
5
840
Transcript
Mastering the Theming in Flutter Muhammed Salih Guler @salihgueler 14.05.2019
About Me • Android Engineer @ • Flutter and Dart
GDE • Flutter Berlin Co-organiser
Theming • A theme describes the colors and typographic choices
of an application. • It’s important to establish a general language between your designer and developer
Theming contd. • A primary color is the color displayed
most frequently across your app’s screens and components. • A secondary color provides more ways to accent and distinguish your product.
What is Flutter? • Google’s Mobile Development SDK • Open
Source • One codebase for multiple platform • Written with Dart • Performant UX • Hot Reload
Theming in Flutter
None
Theming • Uses Theme widget • Applies a theme to
descendant widgets. • It can be implemented in 2 ways ◦ App-wide ◦ Widget
Creating Themes
theme.dart const Theme({ Key key, @required this.data, this.isMaterialAppTheme = false,
@required this.child, })
main.dart Theme( // Create a unique theme with "ThemeData" data:
ThemeData( accentColor: Colors.yellow, ), child: FloatingActionButton( onPressed: _incrementCounter, child: Icon(Icons.add), ), );
main.dart Theme( // Create a unique theme with "ThemeData" data:
ThemeData( accentColor: Colors.yellow, ), child: FloatingActionButton( onPressed: _incrementCounter, child: Icon(Icons.add), ), );
None
main.dart void main() => runApp(MyApp());
main.dart class MyApp extends StatelessWidget { @override Widget build(BuildContext context)
{ return MaterialApp( theme: ThemeData( primarySwatch: Colors.deepOrange, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }
app.dart return AnimatedTheme( data: theme, isMaterialAppTheme: true, child: widget.builder !=
null ? Builder( builder: (BuildContext context) { return widget.builder(context, child); }, ) : child, );
None
ThemeData • Holds the color and typography values for a
material design theme. • Used to configure a Theme widget.
ThemeData contd. • Brightness ◦ Dark ◦ Light
main.dart class MyApp extends StatelessWidget { @override Widget build(BuildContext context)
{ return MaterialApp( theme: ThemeData( brightness: Brightness.dark ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }
None
ThemeData contd. • Primary color pallette ◦ primarySwatch
main.dart class MyApp extends StatelessWidget { @override Widget build(BuildContext context)
{ return MaterialApp( theme: ThemeData( primarySwatch: Colors.deepOrange, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }
None
ThemeData contd. • Accent color ◦ accentColor or secondary color
main.dart class MyApp extends StatelessWidget { @override Widget build(BuildContext context)
{ return MaterialApp( theme: ThemeData( accentColor: Colors.deepOrange, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }
None
ThemeData contd. • Colors and it’s brightness • Fonts •
Icon themes • Individual themes for screen components • Cupertino theming
Advanced Theming in Flutter (Okay not so much)
Adding a Font • Download the file from a provider
(Google Fonts) • Add it to pubspec.yaml
regular 400 regular 400 Italic medium 500 medium 500 Italic
semi-bold 600 semi-bold 600 Italic bold 700 bold 700 Italic extra-bold 800 extra-bold 800 Italic black 900 black 900 Italic Font weights
pubspec.yaml fonts: - family: Raleway fonts: - asset: assets/fonts/Raleway-Medium.ttf -
asset: assets/fonts/Raleway-MediumItalic.ttf style: italic - asset: assets/fonts/Raleway-Bold.ttf weight: 700
main.dart ThemeData( primaryColor: Colors.deepOrange, accentColor: Colors.deepPurple, fontFamily: 'Raleway' )
main.dart Text( '$_counter', style: Theme.of(context).textTheme.display1.copyWith(fontWeigh t: FontWeight.w700), )
None
main.dart const TextTheme({ this.display4, this.display3, this.display2, this.display1, this.headline, this.title, ...
this.subhead, this.body2, this.body1, this.caption, this.button, this.subtitle, this.overline, });
styles_example.dart class BrandColors { // Color palette static const mainTextColor
= const Color(0xff000000); }
styles_example.dart class CustomStyles { // Text styles static const customTextStyle
= const TextStyle( color: BrandColors.mainTextColor, fontFamily: "Raleway", fontStyle: FontStyle.italic, fontSize: 32.0 ); }
styles_example.dart Text( 'You have pushed the button this many times:',
style: CustomStyles.customTextStyle, textAlign: TextAlign.center, ),
None
What to do next? Codelabs: • MDC 101 in Flutter
Read: • Flutter theme documentation • Material Design website
Thank You! • Twitter: @salihgueler • GitHub: @salihgueler • Medium:
@muhammedsalihguler • E-mail:
[email protected]