Skip to content

Commit b29740a

Browse files
authored
Merge pull request #10 from naumansamtia/migrate_to_android_embedding
2 parents b24096b + b0a42b8 commit b29740a

File tree

7 files changed

+278
-41
lines changed

7 files changed

+278
-41
lines changed

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (github_keystorePropertiesFile.exists()) {
3232
}
3333

3434
android {
35-
compileSdkVersion 28
35+
compileSdkVersion 29
3636

3737
sourceSets {
3838
main.java.srcDirs += 'src/main/kotlin'
@@ -46,7 +46,7 @@ android {
4646
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4747
applicationId "com.propakistani.wordpress_flutter"
4848
minSdkVersion 16
49-
targetSdkVersion 28
49+
targetSdkVersion 29
5050
versionCode flutterVersionCode.toInteger()
5151
versionName flutterVersionName
5252
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

android/app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<uses-permission android:name="android.permission.INTERNET"/>
1010

1111
<application
12-
android:name="io.flutter.app.FlutterApplication"
1312
android:label="wordpress_flutter"
1413
android:icon="@mipmap/ic_launcher">
1514
<activity
@@ -24,12 +23,15 @@
2423
there is no splash screen (such as the default splash screen
2524
defined in @style/LaunchTheme). -->
2625
<meta-data
27-
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
28-
android:value="true" />
26+
android:name="io.flutter.embedding.android.SplashScreenDrawable"
27+
android:resource="@drawable/launch_background" />
2928
<intent-filter>
3029
<action android:name="android.intent.action.MAIN"/>
3130
<category android:name="android.intent.category.LAUNCHER"/>
3231
</intent-filter>
3332
</activity>
33+
<meta-data
34+
android:name="flutterEmbedding"
35+
android:value="2" />
3436
</application>
3537
</manifest>
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
package com.propakistani.wordpress_flutter
22

3-
import android.os.Bundle
43

5-
import io.flutter.app.FlutterActivity
6-
import io.flutter.plugins.GeneratedPluginRegistrant
4+
import io.flutter.embedding.android.FlutterActivity
75

8-
class MainActivity: FlutterActivity() {
9-
override fun onCreate(savedInstanceState: Bundle?) {
10-
super.onCreate(savedInstanceState)
11-
GeneratedPluginRegistrant.registerWith(this)
12-
}
6+
class MainActivity: FlutterActivity(){
137
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
4-
<!-- Show a splash screen on the activity. Automatically removed when
5-
Flutter draws its first frame -->
64
<item name="android:windowBackground">@drawable/launch_background</item>
75
</style>
6+
<!-- Theme applied to the Android Window as soon as the process has started.
7+
This theme determines the color of the Android Window while your
8+
Flutter UI initializes, as well as behind your Flutter UI while its
9+
running.
10+
11+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
12+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
13+
<item name="android:windowBackground">@android:color/white</item>
14+
</style>
815
</resources>

lib/pages/post_details.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_html/flutter_html.dart';
3+
import 'package:flutter_html/style.dart';
34

45
import '../model/post_entity.dart';
56
import '../widgets/helpers.dart';
@@ -81,13 +82,17 @@ class PostDetails extends StatelessWidget {
8182
];
8283
},
8384
body: SingleChildScrollView(
84-
child: Html(
85-
data: post.content,
86-
padding: EdgeInsets.all(8.0),
87-
linkStyle: const TextStyle(
88-
color: Colors.blueAccent,
89-
decorationColor: Colors.blueAccent,
90-
decoration: TextDecoration.underline,
85+
child: Padding(
86+
padding: const EdgeInsets.all(8.0),
87+
child: Html(
88+
data: post.content,
89+
style: {
90+
'a' : Style(
91+
color: Colors.blueAccent,
92+
textDecoration: TextDecoration.underline,
93+
textDecorationColor: Colors.blueAccent
94+
)
95+
},
9196
),
9297
),
9398
),

0 commit comments

Comments
 (0)