mirror of
https://github.com/flutter/samples.git
synced 2026-04-01 01:03:30 +00:00
Add content resizing sample (#2756)
Add a content resizing sample for iOS to support https://github.com/flutter/flutter/pull/177410 ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I have added sample code updates to the [changelog]. - [x] I updated/added relevant documentation (doc comments with `///`). If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. <!-- Links --> [Flutter Style Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md [Contributors Guide]: https://github.com/flutter/samples/blob/main/CONTRIBUTING.md [changelog]: ../CHANGELOG.md --------- Co-authored-by: Eric Windmill <eric@ericwindmill.com>
This commit is contained in:
48
add_to_app/ios_content_resizing/flutter_module/.gitignore
vendored
Normal file
48
add_to_app/ios_content_resizing/flutter_module/.gitignore
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
.DS_Store
|
||||
.dart_tool/
|
||||
|
||||
.pub/
|
||||
|
||||
.idea/
|
||||
.vagrant/
|
||||
.sconsign.dblite
|
||||
.svn/
|
||||
|
||||
migrate_working_dir/
|
||||
|
||||
*.swp
|
||||
profile
|
||||
|
||||
DerivedData/
|
||||
|
||||
.generated/
|
||||
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspectivev3
|
||||
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
xcuserdata
|
||||
|
||||
*.moved-aside
|
||||
|
||||
*.pyc
|
||||
*sync/
|
||||
Icon?
|
||||
.tags*
|
||||
|
||||
build/
|
||||
.android/
|
||||
.ios/
|
||||
.flutter-plugins-dependencies
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
10
add_to_app/ios_content_resizing/flutter_module/.metadata
Normal file
10
add_to_app/ios_content_resizing/flutter_module/.metadata
Normal file
@@ -0,0 +1,10 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "27ccc2e66f3fd85ad388e3ba038a89251aef41b7"
|
||||
channel: "master"
|
||||
|
||||
project_type: module
|
||||
11
add_to_app/ios_content_resizing/flutter_module/README.md
Normal file
11
add_to_app/ios_content_resizing/flutter_module/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# flutter_module
|
||||
|
||||
A new Flutter module project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
For help getting started with Flutter development, view the online
|
||||
[documentation](https://flutter.dev/).
|
||||
|
||||
For instructions integrating Flutter modules to your existing applications,
|
||||
see the [add-to-app documentation](https://flutter.dev/to/add-to-app).
|
||||
@@ -0,0 +1,4 @@
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
52
add_to_app/ios_content_resizing/flutter_module/lib/main.dart
Normal file
52
add_to_app/ios_content_resizing/flutter_module/lib/main.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const ResizeApp());
|
||||
}
|
||||
|
||||
class ResizeApp extends StatefulWidget {
|
||||
const ResizeApp({super.key});
|
||||
|
||||
@override
|
||||
State<ResizeApp> createState() => _ResizeAppState();
|
||||
}
|
||||
|
||||
class _ResizeAppState extends State<ResizeApp> {
|
||||
int _listSize = 1;
|
||||
void _addToList() {
|
||||
setState(() {
|
||||
_listSize++;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
heightFactor: 1,
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
for (int i = 0; i < _listSize; i++)
|
||||
Container(color: HSVColor.fromAHSV(1, (10.0 * i), 1, 1).toColor(), height: 50, width: 200,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Flutter Widget $i',
|
||||
style: const TextStyle(fontSize: 16, color: Colors.black),
|
||||
),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: _addToList,
|
||||
child: Text('Listception!'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
87
add_to_app/ios_content_resizing/flutter_module/pubspec.yaml
Normal file
87
add_to_app/ios_content_resizing/flutter_module/pubspec.yaml
Normal file
@@ -0,0 +1,87 @@
|
||||
name: flutter_module
|
||||
description: "A new Flutter module project."
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
#
|
||||
# This version is used _only_ for the Runner app, which is used if you just do
|
||||
# a `flutter run`. It has no impact on any other native host app that you embed
|
||||
# your Flutter project into.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.11.0-200.1.beta
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^6.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
flutter:
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add Flutter specific assets to your application, add an assets section,
|
||||
# like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/to/resolution-aware-images
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/to/asset-from-package
|
||||
|
||||
# To add Flutter specific custom fonts to your application, add a fonts
|
||||
# section here, in this "flutter" section. Each entry in this list should
|
||||
# have a "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/to/font-from-package
|
||||
|
||||
|
||||
# This section identifies your Flutter project as a module meant for
|
||||
# embedding in a native host app. These identifiers should _not_ ordinarily
|
||||
# be changed after generation - they are used to ensure that the tooling can
|
||||
# maintain consistency when adding or modifying assets and plugins.
|
||||
# They also do not have any bearing on your native host application's
|
||||
# identifiers, which may be completely independent or the same as these.
|
||||
module:
|
||||
androidX: true
|
||||
androidPackage: com.example.flutter_module
|
||||
iosBundleIdentifier: com.example.flutterModule
|
||||
Reference in New Issue
Block a user