Commit ed947605 authored by 林生雨's avatar 林生雨

fix android

parent 72104934
......@@ -13,6 +13,7 @@ import com.taobao.idlefish.flutterboost.containers.BoostFlutterActivity
import io.flutter.app.FlutterActivity
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.PluginRegistry
......@@ -25,8 +26,16 @@ class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
EventChannel(flutterView, "flutter_channel_event").setStreamHandler(
object : EventChannel.StreamHandler {
override fun onListen(p0: Any?, p1: EventChannel.EventSink?) {
}
MethodChannel(flutterView, "flutter_bury_channel").setMethodCallHandler { call, result ->
override fun onCancel(p0: Any?) {
}
}
)
MethodChannel(flutterView, "flutter_channel").setMethodCallHandler { call, result ->
if (call.method == "FLUTTER_TO_H5") {
} else if (call.method == "FLUTTER_TO_NATIVE") {
......@@ -70,9 +79,9 @@ class MainActivity : FlutterActivity() {
result.success(map)
} else if (call.method == "UPLOAD_IMG") {
result.success("2019/10/17/1156/44dbb13ac6d9");
} else if(call.method =="USER_LOGOUT"){
} else if (call.method == "USER_LOGOUT") {
result.success(true)
}else {
} else {
result.notImplemented()
}
}
......
......@@ -20,6 +20,7 @@ const String MainDirExplain = "全部相片";
class AlbumModel extends BaseModel {
LiveData<List<ScanImageItem>> albumLive = LiveData();
LiveData<int> selectSizeLive = LiveData();
LiveData<List<DirBean>> dirLive = LiveData();
LiveData<String> titleData = LiveData();
......@@ -157,6 +158,7 @@ class AlbumModel extends BaseModel {
_selectList.remove(path);
}
albumLive.notifyView(albumLive.data);
selectSizeLive.notifyView(_selectList.length);
}
void onNext(BuildContext context) {
......
......@@ -7,6 +7,8 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart';
import 'package:gmalpha_flutter/AlbumModel/bean/DirBean.dart';
import 'package:gmalpha_flutter/commonModel/base/BaseComponent.dart';
import 'package:gmalpha_flutter/res/value/ALColors.dart';
import 'AlbumModel.dart';
......@@ -22,30 +24,30 @@ class AlbumPage extends StatefulWidget {
State<StatefulWidget> createState() => AlbumState(model);
}
class AlbumState extends State<AlbumPage> {
class AlbumState extends State<AlbumPage> with SingleTickerProviderStateMixin {
final AlbumModel _model;
AlbumState(this._model);
Animation<double> animation;
AnimationController controller;
@override
void initState() {
super.initState();
_model.initScanImages(context);
controller = new AnimationController(
duration: const Duration(milliseconds: 2000), vsync: this);
animation = new Tween(begin: 0.0, end: 1.0).animate(controller)
..addListener(() {
print("LISTEN!! ${animation.value}");
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: GestureDetector(
onTap: () => Navigator.pop(context, null),
child: Center(
child: Container(
padding: EdgeInsets.fromLTRB(16, 0, 0, 0),
child: Text("取消"),
),
)),
centerTitle: true,
appBar: baseAppBarChangeTitle(
title: GestureDetector(
onTap: () {
_model.changPopState();
......@@ -54,22 +56,29 @@ class AlbumState extends State<AlbumPage> {
stream: _model.titleData.stream,
initialData: _model.titleData.data,
builder: (context, data) {
Widget text;
if (data.data == null) {
text = Text("");
} else {
String showText;
if (data.data.length > 10) {
showText = "${data.data.substring(0, 10)}...";
} else {
showText = data.data;
}
text = baseText(showText, 18, ALColors.Color323232);
}
return Row(
children: <Widget>[
Expanded(
child: Container(),
),
data.data == null
? Text(
MainDirExplain,
style: TextStyle(fontSize: 18),
)
: Text(data.data, style: TextStyle(fontSize: 18)),
text,
Container(
margin: EdgeInsets.fromLTRB(1, 0, 0, 0),
child: Transform(
transform: Matrix4.identity()
..rotateZ(_model.showPop ? 1.6 : 4.7), // 旋转的角度
..rotateZ(!_model.showPop ? 1.6 : 4.7), // 旋转的角度
origin: Offset(10, 10), // 旋转的中心点
child: Icon(
Icons.chevron_right,
......@@ -83,17 +92,27 @@ class AlbumState extends State<AlbumPage> {
],
);
})),
actions: <Widget>[
Center(
child: GestureDetector(
onTap: () => _model.onNext(context),
child: Container(
margin: EdgeInsets.fromLTRB(0, 0, 16, 0),
child: Text(
"下一步",
style: TextStyle(fontSize: 16),
),
)))
action: <Widget>[
StreamBuilder<int>(
stream: _model.selectSizeLive.stream,
initialData: _model.selectSizeLive.data,
builder: (c, data) {
String showText = "下一步";
if (data != 0) {
showText = "$showText($data)";
}
return Center(
child: GestureDetector(
onTap: () => _model.onNext(context),
child: Container(
margin: EdgeInsets.fromLTRB(0, 0, 16, 0),
child: Text(
showText,
style: TextStyle(fontSize: 16),
),
)));
},
)
],
),
body: Stack(
......@@ -106,6 +125,7 @@ class AlbumState extends State<AlbumPage> {
@override
void dispose() {
controller.dispose();
super.dispose();
_model.dispose();
}
......@@ -211,6 +231,7 @@ class AlbumState extends State<AlbumPage> {
if (snapshot.data == null) {
return Container();
} else {
controller.forward();
return Stack(
children: <Widget>[
Container(
......@@ -229,7 +250,7 @@ class AlbumState extends State<AlbumPage> {
return Container(
padding: EdgeInsets.fromLTRB(16, 3, 16, 3),
color: Colors.white,
height: 280,
height: 280 * animation.value,
child: ListView.separated(
separatorBuilder: (context, index) {
return Divider();
......
......@@ -119,11 +119,11 @@ class _MyAppState extends State<MyApp> {
return MaterialApp(
title: 'Flutter Boost example',
debugShowCheckedModeBanner: false,
// routes: {
// '/': (context) {
// return TestPage();
// },
// },
routes: {
'/': (context) {
return TestPage();
},
},
builder: FlutterBoost.init(),
theme: new ThemeData(
primaryColor: Colors.white,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment