diff --git a/examples/get-started/flutter-for/ios_devs/lib/canvas.dart b/examples/get-started/flutter-for/ios_devs/lib/canvas.dart index 96f01fdc40..6362ecfff7 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/canvas.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/canvas.dart @@ -30,9 +30,8 @@ class SignatureState extends State { }); }, onPanEnd: (details) => _points.add(null), - child: - // #docregion custom-paint - CustomPaint( + // #docregion custom-paint + child: CustomPaint( painter: SignaturePainter(_points), size: Size.infinite, ), diff --git a/examples/get-started/flutter-for/ios_devs/lib/column.dart b/examples/get-started/flutter-for/ios_devs/lib/column.dart index d005145b12..5265ebad7a 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/column.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/column.dart @@ -23,9 +23,8 @@ class HomePage extends StatelessWidget { Widget build(BuildContext context) { return const Scaffold( body: Center( - child: - // #docregion column - Column( + // #docregion column + child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(CupertinoIcons.globe), diff --git a/examples/get-started/flutter-for/ios_devs/lib/cupertino_themes.dart b/examples/get-started/flutter-for/ios_devs/lib/cupertino_themes.dart index 813efd082c..970886b3f0 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/cupertino_themes.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/cupertino_themes.dart @@ -13,9 +13,8 @@ class App extends StatelessWidget { @override Widget build(BuildContext context) { - return const - // #docregion theme - CupertinoApp( + // #docregion theme + return const CupertinoApp( theme: CupertinoThemeData( brightness: Brightness.dark, ), @@ -37,9 +36,8 @@ class HomePage extends StatelessWidget { ), ), child: Center( - child: - // #docregion styling-text - Text( + // #docregion styling-text + child: Text( 'Hello, world!', style: TextStyle( fontSize: 30, diff --git a/examples/get-started/flutter-for/ios_devs/lib/images.dart b/examples/get-started/flutter-for/ios_devs/lib/images.dart index 23e10aa51a..79081cc16a 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/images.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/images.dart @@ -6,11 +6,10 @@ class MyWidget extends StatelessWidget { @override Widget build(BuildContext context) { return const Image( - image: - // #docregion asset-image - AssetImage('images/a_dot_burr.jpeg') - // #enddocregion asset-image - ); + // #docregion asset-image + image: AssetImage('images/a_dot_burr.jpeg'), + // #enddocregion asset-image + ); } } diff --git a/examples/get-started/flutter-for/ios_devs/lib/navigation.dart b/examples/get-started/flutter-for/ios_devs/lib/navigation.dart index cfebee5b68..da730b0846 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/navigation.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/navigation.dart @@ -66,9 +66,8 @@ class HomePage extends StatelessWidget { ), ), child: Material( - child: - // #docregion list-view - ListView.builder( + // #docregion list-view + child: ListView.builder( itemCount: mockPersons.length, itemBuilder: (context, index) { final person = mockPersons.elementAt(index); diff --git a/examples/get-started/flutter-for/ios_devs/lib/openapp.dart b/examples/get-started/flutter-for/ios_devs/lib/openapp.dart index f95585f93c..1370f917e6 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/openapp.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/openapp.dart @@ -30,9 +30,8 @@ class HomePage extends StatelessWidget { return CupertinoPageScaffold( child: SafeArea( child: Center( - child: - // #docregion open-app-example - CupertinoButton( + // #docregion open-app-example + child: CupertinoButton( onPressed: () async { await launchUrl( Uri.parse('https://google.com'), diff --git a/examples/get-started/flutter-for/ios_devs/lib/row.dart b/examples/get-started/flutter-for/ios_devs/lib/row.dart index b953a1639d..ff509ffeb5 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/row.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/row.dart @@ -23,9 +23,8 @@ class HomePage extends StatelessWidget { Widget build(BuildContext context) { return const Scaffold( body: Center( - child: - // #docregion row - Row( + // #docregion row + child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(CupertinoIcons.globe), diff --git a/examples/get-started/flutter-for/ios_devs/lib/scroll.dart b/examples/get-started/flutter-for/ios_devs/lib/scroll.dart index e41083b1cc..acaeaf1604 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/scroll.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/scroll.dart @@ -80,9 +80,8 @@ class HomePage extends StatelessWidget { // Finally, display the list of people on the screen, // inside a scroll view of type // SingleChildScrollView (equivalent of a ScrollView in SwiftUI). - body: - // #docregion scroll-example - SingleChildScrollView( + // #docregion scroll-example + body: SingleChildScrollView( child: Column( children: mockPersons .map( diff --git a/examples/get-started/flutter-for/ios_devs/lib/simple_animation.dart b/examples/get-started/flutter-for/ios_devs/lib/simple_animation.dart index 01bd5586bb..534ffede7b 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/simple_animation.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/simple_animation.dart @@ -27,9 +27,8 @@ class _MyHomePageState extends State { Widget build(BuildContext context) { return Scaffold( body: Center( - child: - // #docregion animated-button - AnimatedRotation( + // #docregion animated-button + child: AnimatedRotation( duration: const Duration(seconds: 1), turns: turns, curve: Curves.easeIn, diff --git a/examples/get-started/flutter-for/ios_devs/lib/string_examples.dart b/examples/get-started/flutter-for/ios_devs/lib/string_examples.dart index c5e3d82db7..97cea57c9b 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/string_examples.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/string_examples.dart @@ -11,9 +11,8 @@ class MyWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return - // #docregion access-string - const Text(Strings.welcomeMessage); + // #docregion access-string + return const Text(Strings.welcomeMessage); // #enddocregion access-string } } diff --git a/examples/get-started/flutter-for/ios_devs/lib/stylingbutton.dart b/examples/get-started/flutter-for/ios_devs/lib/stylingbutton.dart index 7a35f82749..041259b686 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/stylingbutton.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/stylingbutton.dart @@ -30,17 +30,16 @@ class HomePage extends StatelessWidget { Widget build(BuildContext context) { return CupertinoPageScaffold( navigationBar: const CupertinoNavigationBar( - middle: - // #docregion custom-font - Text( - 'Cupertino', - style: TextStyle( - fontSize: 40, - fontFamily: 'BungeeSpice', - ), - ) - // #enddocregion custom-font + // #docregion custom-font + middle: Text( + 'Cupertino', + style: TextStyle( + fontSize: 40, + fontFamily: 'BungeeSpice', ), + ), + // #enddocregion custom-font + ), child: Center( // #docregion styling-button child: CupertinoButton( diff --git a/examples/get-started/flutter-for/ios_devs/lib/text_button.dart b/examples/get-started/flutter-for/ios_devs/lib/text_button.dart index 73c9072846..aea0f656c4 100644 --- a/examples/get-started/flutter-for/ios_devs/lib/text_button.dart +++ b/examples/get-started/flutter-for/ios_devs/lib/text_button.dart @@ -23,16 +23,15 @@ class HomePage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( body: Center( - child: - // #docregion text-button - CupertinoButton( - onPressed: () { - // This closure is called when your button is tapped. - }, - child: const Text('Do something'), - ) - // #enddocregion text-button - ), + // #docregion text-button + child: CupertinoButton( + onPressed: () { + // This closure is called when your button is tapped. + }, + child: const Text('Do something'), + ), + // #enddocregion text-button + ), ); } } diff --git a/src/content/get-started/flutter-for/swiftui-devs.md b/src/content/get-started/flutter-for/swiftui-devs.md index fc9c7225ab..eaced7f5ce 100644 --- a/src/content/get-started/flutter-for/swiftui-devs.md +++ b/src/content/get-started/flutter-for/swiftui-devs.md @@ -271,14 +271,14 @@ Button("Do something") { To achieve the same result in **Flutter**, use the `CupertinoButton` class: - + ```dart dartpad="3c9b9a4de431b86725197a7fc2c84158" - CupertinoButton( +CupertinoButton( onPressed: () { // This closure is called when your button is tapped. }, - child: const Text('Do something'), -) + const Text('Do something'), +), ``` **Flutter** gives you access to a variety of buttons with predefined styles. @@ -306,9 +306,9 @@ HStack { **Flutter** uses [`Row`][] rather than `HStack`: - + ```dart dartpad="0365338f938427b01d72e37cea554f75" - Row( +Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(CupertinoIcons.globe), @@ -340,9 +340,9 @@ VStack { **Flutter** uses the same Dart code from the previous example, except it swaps [`Column`][] for `Row`: - + ```dart dartpad="d9a288be0c2a353296fc8825680b84b8" - Column( +Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(CupertinoIcons.globe), @@ -519,9 +519,9 @@ To create a scrolling view, **Flutter** uses [`SingleChildScrollView`][]. In the following example, the function `mockPerson` mocks instances of the `Person` class to create the custom `PersonView` widget. - + ```dart dartpad="a75740320989ed04020d95502a0de34e" - SingleChildScrollView( +SingleChildScrollView( child: Column( children: mockPersons .map( @@ -650,19 +650,19 @@ Flutter names these widgets with the following format: `AnimatedFoo`. For example: To rotate a button, use the [`AnimatedRotation`][] class. This animates the `Transform.rotate` widget. - + ```dart dartpad="0ad0572cbf98ead2e5d31a2a94430f19" - AnimatedRotation( +AnimatedRotation( duration: const Duration(seconds: 1), turns: turns, curve: Curves.easeIn, - child: TextButton( + TextButton( onPressed: () { setState(() { turns += .125; }); }, - child: const Text('Tap me!')), + const Text('Tap me!')), ), ``` @@ -692,9 +692,9 @@ with two classes that help you draw: 1. [`CustomPaint`][] that requires a painter: - + ```dart dartpad="978d64ee66d54177fb639f8a9f801039" - CustomPaint( + CustomPaint( painter: SignaturePainter(_points), size: Size.infinite, ), @@ -797,9 +797,9 @@ call your navigation routes using their names. `mockPersons()`. Tapping a person pushes the person's detail page to the `Navigator` using `pushNamed()`. - + ```dart dartpad="d8b22d4dcbefdc8a2e21f1382cf7dc2a" - ListView.builder( + ListView.builder( itemCount: mockPersons.length, itemBuilder: (context, index) { final person = mockPersons.elementAt(index); @@ -902,15 +902,15 @@ URL to another application. In **Flutter**, use the [`url_launcher`][] plugin. - + ```dart dartpad="695beba25fa8120d89c9960cb222e276" - CupertinoButton( +CupertinoButton( onPressed: () async { await launchUrl( Uri.parse('https://google.com'), ); }, - child: const Text( + const Text( 'Open website', ), ), @@ -932,9 +932,9 @@ In **Flutter**, you can control light and dark mode at the app-level. To control the brightness mode, use the `theme` property of the `App` class: - + ```dart dartpad="18790cfaa8441085994373a4bc4f46b0" - CupertinoApp( +const CupertinoApp( theme: CupertinoThemeData( brightness: Brightness.dark, ), @@ -957,9 +957,9 @@ Text("Hello, world!") To style text in **Flutter**, add a `TextStyle` widget as the value of the `style` parameter of the `Text` widget. - + ```dart dartpad="18790cfaa8441085994373a4bc4f46b0" - Text( +Text( 'Hello, world!', style: TextStyle( fontSize: 30, @@ -1047,15 +1047,15 @@ To add a custom font to your project, follow these steps: After you add the font to your project, you can use it as in the following example: - + ```dart - Text( +Text( 'Cupertino', style: TextStyle( fontSize: 40, fontFamily: 'BungeeSpice', ), -) +), ``` :::note diff --git a/src/content/get-started/flutter-for/uikit-devs.md b/src/content/get-started/flutter-for/uikit-devs.md index a54b4bb845..0a71f8b818 100644 --- a/src/content/get-started/flutter-for/uikit-devs.md +++ b/src/content/get-started/flutter-for/uikit-devs.md @@ -465,8 +465,7 @@ class SignatureState extends State { }); }, onPanEnd: (details) => _points.add(null), - child: - CustomPaint( + child: CustomPaint( painter: SignaturePainter(_points), size: Size.infinite, ), @@ -670,7 +669,7 @@ class Strings { You can access your strings as such: - + ```dart Text(Strings.welcomeMessage); ``` @@ -1498,7 +1497,7 @@ You can now access your images using `AssetImage`: ```dart -AssetImage('images/a_dot_burr.jpeg') +image: AssetImage('images/a_dot_burr.jpeg'), ``` or directly in an `Image` widget: