【发布时间】:2019-12-09 04:07:42
【问题描述】:
该应用程序在调试模式下运行良好,但在安装到我的 Android 手机后无法在发布模式下显示主体。我使用 flutter build apk --split-per-abi 构建并复制了一个输出 apk 文件以安装在手机中。需要帮助。谢谢。
import 'dart:math' as math;
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Earth',
theme: ThemeData(
primarySwatch: Colors.blue, scaffoldBackgroundColor: Colors.white),
home: MyHomePage(title: 'Earth'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
AnimationController _controller;
@override
void initState() {
// Create animation controller.
_controller =
AnimationController(duration: const Duration(seconds: 10), vsync: this)
..addListener(() {
setState(() {
// Force build.
});
})
..addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.dismissed) {
_controller.forward();
} else if (status == AnimationStatus.completed) {
_controller.reverse();
}
});
// Start animation automatically.
_controller.forward(from: 0.0);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Transform.scale(
scale: 1.6,
child: Transform.rotate(
angle: math.pi * _controller.value, // rotate animation
child: Image.network(
"https://ak7.picdn.net/shutterstock/videos/3010597/thumb/1.jpg")))),
);
}
}
【问题讨论】:
标签: flutter