text
stringlengths 1
474
|
---|
brightness: Brightness.dark,
|
),
|
home: HomePage(),
|
);<code_end>
|
<topic_end>
|
<topic_start>
|
Styling text
|
In SwiftUI, you use modifier functions to style text.
|
For example, to change the font of a Text string,
|
use the font() modifier:To style text in Flutter, add a TextStyle widget as the value
|
of the style parameter of the Text widget.
|
<code_start> Text(
|
'Hello, world!',
|
style: TextStyle(
|
fontSize: 30,
|
fontWeight: FontWeight.bold,
|
color: CupertinoColors.systemYellow,
|
),
|
),<code_end>
|
<topic_end>
|
<topic_start>
|
Styling buttons
|
In SwiftUI, you use modifier functions to style buttons.To style button widgets in Flutter, set the style of its child,
|
or modify properties on the button itself.In the following example:
|
<code_start>child: CupertinoButton(
|
color: CupertinoColors.systemYellow,
|
onPressed: () {},
|
padding: const EdgeInsets.all(16),
|
child: const Text(
|
'Do something',
|
style: TextStyle(
|
color: CupertinoColors.systemBlue,
|
fontSize: 30,
|
fontWeight: FontWeight.bold,
|
),
|
),
|
),<code_end>
|
<topic_end>
|
<topic_start>
|
Using custom fonts
|
In SwiftUI, you can use a custom font in your app in two steps.
|
First, add the font file to your SwiftUI project. After adding the file,
|
use the .font() modifier to apply it to your UI components.In Flutter, you control your resources with a file
|
named pubspec.yaml. This file is platform agnostic.
|
To add a custom font to your project, follow these steps:Add your custom font(s) under the fonts section.After you add the font to your project, you can use it as in the
|
following example:
|
<code_start> Text(
|
'Cupertino',
|
style: TextStyle(
|
fontSize: 40,
|
fontFamily: 'BungeeSpice',
|
),
|
)<code_end>
|
info Note
|
To download custom fonts to use in your apps,
|
check out Google Fonts.<topic_end>
|
<topic_start>
|
Bundling images in apps
|
In SwiftUI, you first add the image files to Assets.xcassets,
|
then use the Image view to display the images.To add images in Flutter, follow a method similar to how you added
|
custom fonts.Add this asset to the pubspec.yaml file.After adding your image, display it using the Image widget’s
|
.asset() constructor. This constructor:To review a complete example, check out the Image docs.<topic_end>
|
<topic_start>
|
Bundling videos in apps
|
In SwiftUI, you bundle a local video file with your app in two
|
steps.
|
First, you import the AVKit framework, then you instantiate a
|
VideoPlayer view.In Flutter, add the video_player plugin to your project.
|
This plugin allows you to create a video player that works on
|
Android, iOS, and on the web from the same codebase.To review a complete walkthrough, check out the video_player example.
|
<topic_end>
|
<topic_start>Flutter for UIKit developers
|
iOS developers with experience using UIKit
|
who want to write mobile apps using Flutter
|
should review this guide.
|
It explains how to apply existing UIKit knowledge to Flutter.info Note
|
If you have experience building apps with SwiftUI,
|
check out Flutter for SwiftUI developers instead.Flutter is a framework for building cross-platform applications
|
that uses the Dart programming language.
|
To understand some differences between programming with Dart
|
and programming with Swift, see Learning Dart as a Swift Developer
|
and Flutter concurrency for Swift developers.Your iOS and UIKit knowledge and experience
|
are highly valuable when building with Flutter.
|
Flutter also makes a number of adaptations
|
to app behavior when running on iOS.
|
To learn how, see Platform adaptations.info
|
To integrate Flutter code into an existing iOS app,
|
check out Add Flutter to existing app.Use this guide as a cookbook.
|
Jump around and find questions that address your most relevant needs.<topic_end>
|
<topic_start>
|
Overview
|
As an introduction, watch the following video.
|
It outlines how Flutter works on iOS and how to use Flutter to build iOS apps.<topic_end>
|
<topic_start>
|
Views vs. Widgets
|
How is react-style, or declarative,
|
programming different from the
|
traditional imperative style?
|
For a comparison, see Introduction to declarative UI.In UIKit, most of what you create in the UI is done using view objects,
|
which are instances of the UIView class.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.