Skip to content

Commit 3358c2b

Browse files
author
Soumya Mahunt
committed
feat: allow local flutter module to be declared dependency
1 parent 90074ee commit 3358c2b

33 files changed

+1550
-65
lines changed

.gitignore

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,117 @@
1+
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
## User settings
6+
xcuserdata/
7+
8+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
9+
*.xcscmblueprint
10+
*.xccheckout
11+
12+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
13+
build/
14+
vendor/
15+
DerivedData/
16+
*.moved-aside
17+
*.pbxuser
18+
!default.pbxuser
19+
*.mode1v3
20+
!default.mode1v3
21+
*.mode2v3
22+
!default.mode2v3
23+
*.perspectivev3
24+
!default.perspectivev3
25+
# OS generated files #
26+
######################
127
.DS_Store
28+
.DS_Store?
29+
._*
30+
.Spotlight-V100
31+
.Trashes
32+
ehthumbs.db
33+
Thumbs.db
34+
35+
# CocoaPods
36+
# We recommend against adding the Pods directory to your .gitignore. However
37+
# you should judge for yourself, the pros and cons are mentioned at:
38+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
39+
Pods/
40+
contents.xcworkspacedata
41+
IDEWorkspaceChecks.plist
242
pkg
43+
44+
# Miscellaneous
45+
*.class
46+
*.log
47+
*.pyc
48+
*.swp
49+
.DS_Store
50+
.atom/
51+
.buildlog/
52+
.history
53+
.svn/
54+
55+
# IntelliJ related
56+
*.ipr
57+
*.iws
358
.idea/
59+
60+
# The .vscode folder contains launch configuration and tasks you configure in
61+
# VS Code which you may wish to be included in version control, so this line
62+
# is commented out by default.
63+
#.vscode/
64+
65+
# Flutter/Dart/Pub related
66+
**/doc/api/
67+
.dart_tool/
68+
.flutter-plugins
69+
.flutter-plugins-dependencies
70+
.packages
71+
.pub-cache/
72+
.pub/
73+
build/
74+
75+
# Android related
76+
**/android/**/gradle-wrapper.jar
77+
**/android/.gradle
78+
**/android/captures/
79+
**/android/gradlew
80+
**/android/gradlew.bat
81+
**/android/local.properties
82+
**/android/**/GeneratedPluginRegistrant.java
83+
84+
# iOS/XCode related
85+
**/ios/**/*.mode1v3
86+
**/ios/**/*.mode2v3
87+
**/ios/**/*.moved-aside
88+
**/ios/**/*.pbxuser
89+
**/ios/**/*.perspectivev3
90+
**/ios/**/*sync/
91+
**/ios/**/.sconsign.dblite
92+
**/ios/**/.tags*
93+
**/ios/**/.vagrant/
94+
**/ios/**/DerivedData/
95+
**/ios/**/Icon?
96+
**/ios/**/Pods/
97+
**/ios/**/.symlinks/
98+
**/ios/**/profile
99+
**/ios/**/xcuserdata
100+
**/ios/.generated/
101+
**/ios/Flutter/App.framework
102+
**/ios/Flutter/Flutter.framework
103+
**/ios/Flutter/Flutter.podspec
104+
**/ios/Flutter/Generated.xcconfig
105+
**/ios/Flutter/ephemeral
106+
**/ios/Flutter/app.flx
107+
**/ios/Flutter/app.zip
108+
**/ios/Flutter/flutter_assets/
109+
**/ios/Flutter/flutter_export_environment.sh
110+
**/ios/ServiceDefinitions.json
111+
**/ios/Runner/GeneratedPluginRegistrant.*
112+
113+
# Exceptions to above rules.
114+
!**/ios/**/default.mode1v3
115+
!**/ios/**/default.mode2v3
116+
!**/ios/**/default.pbxuser
117+
!**/ios/**/default.perspectivev3

cocoapods-embed-flutter.gemspec

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
44
require 'cocoapods-embed-flutter/gem_version.rb'
55

66
Gem::Specification.new do |spec|
7-
spec.name = 'cocoapods-embed-flutter'
7+
spec.name = CocoapodsEmbedFlutter::NAME
88
spec.version = CocoapodsEmbedFlutter::VERSION
9-
spec.authors = ['Soumya Mahunt']
10-
spec.email = ['soumya.mahunt@tatadigital.com']
11-
spec.description = %q{A short description of cocoapods-embed-flutter.}
12-
spec.summary = %q{A longer description of cocoapods-embed-flutter.}
13-
spec.homepage = 'https://github.com/EXAMPLE/cocoapods-embed-flutter'
9+
spec.authors = ['Soumya Ranjan Mahunt']
10+
spec.email = ['devsoumyamahunt@gmail.com']
11+
spec.description = %q{Embed flutter plugins in iOS projects.}
12+
spec.summary = %q{Embed flutter plugins in iOS projects.}
13+
spec.homepage = 'https://github.com/soumyamahunt/cocoapods-embed-flutter'
1414
spec.license = 'MIT'
1515

1616
spec.files = `git ls-files`.split($/)
1717
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
1818
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
1919
spec.require_paths = ['lib']
2020

21+
spec.add_dependency 'yaml'
22+
2123
spec.add_development_dependency 'bundler', '~> 1.3'
2224
spec.add_development_dependency 'rake'
2325
end

example/flutter_module/.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.DS_Store
2+
.dart_tool/
3+
4+
.packages
5+
.pub/
6+
7+
.idea/
8+
.vagrant/
9+
.sconsign.dblite
10+
.svn/
11+
12+
*.swp
13+
profile
14+
15+
DerivedData/
16+
17+
.generated/
18+
19+
*.pbxuser
20+
*.mode1v3
21+
*.mode2v3
22+
*.perspectivev3
23+
24+
!default.pbxuser
25+
!default.mode1v3
26+
!default.mode2v3
27+
!default.perspectivev3
28+
29+
xcuserdata
30+
31+
*.moved-aside
32+
33+
*.pyc
34+
*sync/
35+
Icon?
36+
.tags*
37+
38+
build/
39+
.android/
40+
.ios/
41+
.flutter-plugins
42+
.flutter-plugins-dependencies
43+
44+
# Symbolication related
45+
app.*.symbols
46+
47+
# Obfuscation related
48+
app.*.map.json

example/flutter_module/.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 097d3313d8e2c7f901932d63e537c1acefb87800
8+
channel: stable
9+
10+
project_type: module

example/flutter_module/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# flutter_module
2+
3+
A new flutter module project.
4+
5+
## Getting Started
6+
7+
For help getting started with Flutter, view our online
8+
[documentation](https://flutter.dev/).
9+
10+
For instructions integrating Flutter modules to your existing applications,
11+
see the [add-to-app documentation](https://flutter.dev/docs/development/add-to-app).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
# Additional information about this file can be found at
4+
# https://dart.dev/guides/language/analysis-options
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
7+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
8+
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
9+
<excludeFolder url="file://$MODULE_DIR$/.idea" />
10+
<excludeFolder url="file://$MODULE_DIR$/.pub" />
11+
<excludeFolder url="file://$MODULE_DIR$/build" />
12+
</content>
13+
<orderEntry type="sourceFolder" forTests="false" />
14+
<orderEntry type="library" name="Dart SDK" level="project" />
15+
<orderEntry type="library" name="Flutter Plugins" level="project" />
16+
<orderEntry type="library" name="Dart Packages" level="project" />
17+
</component>
18+
</module>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="android" name="Android">
5+
<configuration>
6+
<option name="ALLOW_USER_CONFIGURATION" value="false" />
7+
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/.android/gen" />
8+
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/.android/gen" />
9+
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/.android/AndroidManifest.xml" />
10+
<option name="RES_FOLDER_RELATIVE_PATH" value="/.android/res" />
11+
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/.android/assets" />
12+
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/.android/libs" />
13+
<option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/.android/proguard_logs" />
14+
</configuration>
15+
</facet>
16+
</component>
17+
<component name="NewModuleRootManager" inherit-compiler-output="true">
18+
<exclude-output />
19+
<content url="file://$MODULE_DIR$/.android">
20+
<sourceFolder url="file://$MODULE_DIR$/.android/Flutter/src/main/java" isTestSource="false" />
21+
<sourceFolder url="file://$MODULE_DIR$/.android/gen" isTestSource="false" generated="true" />
22+
</content>
23+
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
24+
<orderEntry type="sourceFolder" forTests="false" />
25+
<orderEntry type="library" name="Flutter for Android" level="project" />
26+
</component>
27+
</module>

example/flutter_module/lib/main.dart

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import 'package:flutter/material.dart';
2+
3+
void main() => runApp(const MyApp());
4+
5+
class MyApp extends StatelessWidget {
6+
const MyApp({Key? key}) : super(key: key);
7+
8+
// This widget is the root of your application.
9+
@override
10+
Widget build(BuildContext context) {
11+
return MaterialApp(
12+
title: 'Flutter Demo',
13+
theme: ThemeData(
14+
// This is the theme of your application.
15+
//
16+
// Try running your application with "flutter run". You'll see the
17+
// application has a blue toolbar. Then, without quitting the app, try
18+
// changing the primarySwatch below to Colors.green and then invoke
19+
// "hot reload" (press "r" in the console where you ran "flutter run",
20+
// or press Run > Flutter Hot Reload in a Flutter IDE). Notice that the
21+
// counter didn't reset back to zero; the application is not restarted.
22+
primarySwatch: Colors.blue,
23+
),
24+
home: const MyHomePage(title: 'Flutter Demo Home Page'),
25+
);
26+
}
27+
}
28+
29+
class MyHomePage extends StatefulWidget {
30+
const MyHomePage({Key? key, required this.title}) : super(key: key);
31+
32+
// This widget is the home page of your application. It is stateful, meaning
33+
// that it has a State object (defined below) that contains fields that affect
34+
// how it looks.
35+
36+
// This class is the configuration for the state. It holds the values (in this
37+
// case the title) provided by the parent (in this case the App widget) and
38+
// used by the build method of the State. Fields in a Widget subclass are
39+
// always marked "final".
40+
41+
final String title;
42+
43+
@override
44+
State<MyHomePage> createState() => _MyHomePageState();
45+
}
46+
47+
class _MyHomePageState extends State<MyHomePage> {
48+
int _counter = 0;
49+
50+
void _incrementCounter() {
51+
setState(() {
52+
// This call to setState tells the Flutter framework that something has
53+
// changed in this State, which causes it to rerun the build method below
54+
// so that the display can reflect the updated values. If we changed
55+
// _counter without calling setState(), then the build method would not be
56+
// called again, and so nothing would appear to happen.
57+
_counter++;
58+
});
59+
}
60+
61+
@override
62+
Widget build(BuildContext context) {
63+
// This method is rerun every time setState is called, for instance as done
64+
// by the _incrementCounter method above.
65+
//
66+
// The Flutter framework has been optimized to make rerunning build methods
67+
// fast, so that you can just rebuild anything that needs updating rather
68+
// than having to individually change instances of widgets.
69+
return Scaffold(
70+
appBar: AppBar(
71+
// Here we take the value from the MyHomePage object that was created by
72+
// the App.build method, and use it to set our appbar title.
73+
title: Text(widget.title),
74+
),
75+
body: Center(
76+
// Center is a layout widget. It takes a single child and positions it
77+
// in the middle of the parent.
78+
child: Column(
79+
// Column is also a layout widget. It takes a list of children and
80+
// arranges them vertically. By default, it sizes itself to fit its
81+
// children horizontally, and tries to be as tall as its parent.
82+
//
83+
// Invoke "debug painting" (press "p" in the console, choose the
84+
// "Toggle Debug Paint" action from the Flutter Inspector in Android
85+
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
86+
// to see the wireframe for each widget.
87+
//
88+
// Column has various properties to control how it sizes itself and
89+
// how it positions its children. Here we use mainAxisAlignment to
90+
// center the children vertically; the main axis here is the vertical
91+
// axis because Columns are vertical (the cross axis would be
92+
// horizontal).
93+
mainAxisAlignment: MainAxisAlignment.center,
94+
children: <Widget>[
95+
const Text(
96+
'You have pushed the button this many times:',
97+
),
98+
Text(
99+
'$_counter',
100+
style: Theme.of(context).textTheme.headline4,
101+
),
102+
],
103+
),
104+
),
105+
floatingActionButton: FloatingActionButton(
106+
onPressed: _incrementCounter,
107+
tooltip: 'Increment',
108+
child: const Icon(Icons.add),
109+
), // This trailing comma makes auto-formatting nicer for build methods.
110+
);
111+
}
112+
}

0 commit comments

Comments
 (0)