Skip to content

Commit

Permalink
support nullsafety,v2 embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
ggichure committed Mar 10, 2021
1 parent f77de73 commit faf9884
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 53 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ Conver color to hex

use channel stable
## 2.0.0
remove unused files in lib
remove unused files in lib

## 2.0.2
null safety
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"hexcolor","path":"/media/ggriffo/ns/oss/hexcolor/","dependencies":[]}],"android":[{"name":"hexcolor","path":"/media/ggriffo/ns/oss/hexcolor/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"hexcolor","dependencies":[]}],"date_created":"2021-03-08 09:06:21.219407","version":"2.0.1"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"hexcolor","path":"/media/ggriffo/ns/oss/hexcolor/","dependencies":[]}],"android":[{"name":"hexcolor","path":"/media/ggriffo/ns/oss/hexcolor/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"hexcolor","dependencies":[]}],"date_created":"2021-03-10 18:59:17.645261","version":"2.0.1"}
3 changes: 3 additions & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package com.ggichure.github.hexcolor_example

import android.os.Bundle
import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
}
}
38 changes: 2 additions & 36 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';

void main() => runApp(MyApp());
Expand All @@ -12,40 +9,9 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';

///use hex color strings in your app
static const MethodChannel _channel = const MethodChannel('hexcolor');

@override
void initState() {
super.initState();
initPlatformState();
}

static Future<String> get platformVersion async {
final String version = await _channel.invokeMethod('getPlatformVersion');
return version;
}

// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
platformVersion = await platformVersion;
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}

// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;

setState(() {
_platformVersion = platformVersion;
});
}

String textColor = ColorToHex(Colors.teal).toString();
Expand All @@ -59,15 +25,15 @@ class _MyAppState extends State<MyApp> {
),
body: Container(
decoration: new BoxDecoration(
color: ColorToHex(Colors.blueGrey[100]),
color: Colors.blueGrey[100],
),
child: Center(
child: Container(
height: 200,
child: Column(
children: [
Text(
'Running on: $_platformVersion\n',
"I'm using hexcolor",
style: TextStyle(color: HexColor("#f2f2f2")),
),
Text(
Expand Down
1 change: 1 addition & 0 deletions example/linux/flutter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ add_custom_command(
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
linux-x64 ${CMAKE_BUILD_TYPE}
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.1"
version: "2.0.2"
js:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Demonstrates how to use the hexcolor plugin.
publish_to: 'none'

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: hexcolor
description: A flutter plugin for bringing hex colors to dart hexcolorPlugin.
version: 2.0.1
version: 2.0.2


homepage: https://github.com/ggichure/hexcolor
Expand Down
4 changes: 0 additions & 4 deletions test/hexcolor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@ void main() {
tearDown(() {
channel.setMockMethodCallHandler(null);
});

test('getPlatformVersion', () async {
expect(await HexColor.platformVersion, '42');
});
}

0 comments on commit faf9884

Please sign in to comment.