提交 df14c5cc authored 作者: ritheshSalyan's avatar ritheshSalyan

Update example to support Flutter 3

上级 df7fa9ef
...@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' ...@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 30 compileSdkVersion 31
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
...@@ -36,7 +36,7 @@ android { ...@@ -36,7 +36,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.screenshot.example" applicationId "com.screenshot.example"
minSdkVersion 17 minSdkVersion 17
targetSdkVersion 30 targetSdkVersion 31
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:exported="true"
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
......
buildscript { buildscript {
ext.kotlin_version = '1.3.50' ext.kotlin_version = '1.6.0'
repositories { repositories {
google() google()
jcenter() jcenter()
......
...@@ -17,7 +17,7 @@ class MyApp extends StatelessWidget { ...@@ -17,7 +17,7 @@ class MyApp extends StatelessWidget {
textTheme: TextTheme( textTheme: TextTheme(
headline6: TextStyle( headline6: TextStyle(
color: Colors.yellow, color: Colors.yellow,
fontSize: 50, // fontSize: 50,
)), )),
// This is the theme of your application. // This is the theme of your application.
// //
...@@ -79,7 +79,14 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -79,7 +79,14 @@ class _MyHomePageState extends State<MyHomePage> {
border: Border.all(color: Colors.blueAccent, width: 5.0), border: Border.all(color: Colors.blueAccent, width: 5.0),
color: Colors.amberAccent, color: Colors.amberAccent,
), ),
child: Text("This widget will be captured as an image")), child: Stack(
children: [
Image.asset(
'assets/images/flutter.png',
),
Text("This widget will be captured as an image"),
],
)),
), ),
SizedBox( SizedBox(
height: 25, height: 25,
...@@ -109,9 +116,16 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -109,9 +116,16 @@ class _MyHomePageState extends State<MyHomePage> {
border: Border.all(color: Colors.blueAccent, width: 5.0), border: Border.all(color: Colors.blueAccent, width: 5.0),
color: Colors.redAccent, color: Colors.redAccent,
), ),
child: Text( child: Stack(
"This is an invisible widget", children: [
style: Theme.of(context).textTheme.headline6, Image.asset(
'assets/images/flutter.png',
),
Text(
"This is an invisible widget",
style: Theme.of(context).textTheme.headline6,
),
],
)); ));
screenshotController screenshotController
.captureFromWidget( .captureFromWidget(
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST}) foreach(plugin ${FLUTTER_PLUGIN_LIST})
...@@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) ...@@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin) endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论