This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class Mask extends StatefulWidget { | |
final Function onTap; | |
final Rect rect; | |
const Mask({Key key, this.onTap, this.rect}) : super(key: key); | |
@override | |
_MaskState createState() => _MaskState(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomeContainer extends StatefulWidget { | |
final List<Widget> children; | |
final int currentIndex; | |
const HomeContainer({ | |
Key key, | |
this.children, | |
this.currentIndex, | |
}) : super(key: key); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:io'; | |
main(List<String> arguments) async { | |
// final path = "timg.jpg"; | |
// final path = "/Users/cai/Desktop/1CD83646CA9CF1C2B0F7364B341E8580.gif"; | |
final path = "/Users/cai/Desktop/sxwphone.png"; | |
final imgFile = File(path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:provider/provider.dart'; | |
class BaseProvider extends ChangeNotifier { | |
RouteHelper get route => RouteHelper(); | |
T getProvider<T>() { | |
return Provider.of<T>(route.navigatorKey.currentContext); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Future<Uint8List> getImageFromEditorKey( | |
GlobalKey<ExtendedImageEditorState> editorKey) async { | |
Uint8List result; | |
final provider = | |
editorKey.currentState.widget.extendedImageState.imageProvider; | |
if (provider is AssetImage) { | |
ByteData byteData; | |
if (provider.package == null) { | |
byteData = await rootBundle.load(provider.assetName); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int dayOfMonth(int year, int month) { | |
return DateTime(year, month + 1, 1).subtract(Duration(days: 1)).day; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class ThrottleWrapper extends StatefulWidget { | |
final Duration throttleDuration; | |
final Widget child; | |
final Function onTap; | |
const ThrottleWrapper({ | |
Key key, | |
this.throttleDuration, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:typed_data'; | |
import 'package:extended_image/extended_image.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:image_editor/image_editor.dart'; | |
import 'const/resource.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Handler | |
import android.os.Looper | |
import io.flutter.plugin.common.MethodCall | |
import io.flutter.plugin.common.MethodChannel | |
import java.util.concurrent.locks.ReentrantLock | |
import kotlin.concurrent.withLock | |
/// create 2019-11-27 by cai | |
class ReplyHandler(val call: MethodCall, private val result: MethodChannel.Result?) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
ext.kotlin_version = '1.3.50' | |
repositories { | |
maven{ | |
url 'https://maven.aliyun.com/repository/google' | |
} | |
maven{ | |
url 'https://maven.aliyun.com/repository/jcenter' | |
} | |
} |