Error reporting is shown in figure
Problem code
import 'package:flutter/material.dart';
void main() {
runApp(SampleAppPage());
}
class SampleAppPage extends StatefulWidget {
const SampleAppPage({Key?key}) : super(key: key);
@override
_SampleAppPageState createState() => _SampleAppPageState();
}
class _SampleAppPageState extends State<SampleAppPage>
with SingleTickerProviderStateMixin {
late AnimationController controller;
late CurvedAnimation curve;
@override
void initState() {
super.initState();
controller = AnimationController(
duration: const Duration(milliseconds: 2000),
vsync: this,
);
curve = CurvedAnimation(
parent: controller,
curve: Curves.easeIn,
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: GestureDetector(
child: RotationTransition(
turns: curve,
child: const FlutterLogo(size: 200.0),
),
onDoubleTap: () {
if (controller.isCompleted) {
controller.reverse();
} else {
controller.forward();
}
},
),
),
);
}
}
Reason: the root component of the fluent interface must be MaterialApp
Code after repair
import 'package:flutter/material.dart';
void main() {
runApp(SampleApp());
}
class SampleApp extends StatelessWidget {
// This widget is the root of your application.
const SampleApp({Key?key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Sample App',
home: SampleAppPage(),
);
}
}
class SampleAppPage extends StatefulWidget {
const SampleAppPage({Key?key}) : super(key: key);
@override
_SampleAppPageState createState() => _SampleAppPageState();
}
class _SampleAppPageState extends State<SampleAppPage>
with SingleTickerProviderStateMixin {
late AnimationController controller;
late CurvedAnimation curve;
@override
void initState() {
super.initState();
controller = AnimationController(
duration: const Duration(milliseconds: 2000),
vsync: this,
);
curve = CurvedAnimation(
parent: controller,
curve: Curves.easeIn,
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: GestureDetector(
child: RotationTransition(
turns: curve,
child: const FlutterLogo(size: 200.0),
),
onDoubleTap: () {
if (controller.isCompleted) {
controller.reverse();
} else {
controller.forward();
}
},
),
),
);
}
}
Read More:
- [Solved] Flutter package flutter build apk Error: permission-handle
- flutter, Unable to buy item, Error response code: 7 & flutter_inapp_purchase
- [Solved] Flutter – AAPT: error: resource android:attr/dialogCornerRadius not found.
- Flutter Error: dump failed because resource AndroidManifest.xml not found [How to Solve]
- [Easy Solution] flutter Run Error: library “libflutter.so“ not found
- Flutter flutter doctor –android-licenses [How to Solve]
- Flutter Xcode Module not found or LibreSSL SSL_connect: SSL_ERROR_SYSCALL
- [Solved] flutter Project Error: ScrollController attached to multiple scroll views, Failed assertion: line 109 pos 12
- [Solved] error: package android.support.design.widget does not exist
- How to Solve Error inflating class android.support.design.widget.FloatingActionButton
- [Solved] Bringing up interface eth0: Error: No suitable device found: no device found for connection ‘System eth0’.
- [Solved] ViewBinding Error: java.lang.ClassCastException: android.widget.RelativeLayout cannot be
- [Solved] Unreal Engine Error: Widget Blueprint could not be loaded because it derives from an invalid class
- Gradle Package Project Lombok Not Working: No serializer found for class com.qbb.User and no properties discovered to create BeanSerializer……
- [Solved] Vsync Error: this error in animationcontroller in fluent
- Flutter Package error: keyboard_visibility:verifyReleaseResources
- jitpack.io ERROR: No build artifacts found [How to Solve]
- [Solved] Flutter Error: fluwx:compileDebugKotlin
- [Solved] @webservice Error: org.apache.cxf.common.i18n.UncheckedException: No operation was found with
- flutter doctor –android-licenses error [How to Solve]