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
const Color GRAY_COLOR = Colors.grey; | |
const Color BROWN_COLOR = Colors.brown; | |
const Color RED_COLOR = Colors.red; | |
const Color ORANGE_COLOR = Colors.orange; | |
const Color BLUE_COLOR = Colors.blue; | |
const Color GREEN_COLOR = Colors.green; | |
const Color WHITE_COLOR = Colors.white; |
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
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Drag and Drop Demo', | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData(primarySwatch: Colors.green), | |
routes: <String, WidgetBuilder>{ |
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
DragTarget( | |
builder: (context, List<String> candidateData, rejectedData) { | |
return Center( | |
child: isSuccessful | |
? Padding( | |
padding: EdgeInsets.only(top: 100.0), | |
child: Container( | |
color: Colors.yellow, | |
height: 200.0, | |
width: 200.0, |
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
Draggable( | |
data: 'Flutter', | |
child: FlutterLogo( | |
size: 100.0, | |
), | |
feedback: FlutterLogo( | |
size: 100.0, | |
), | |
childWhenDragging: Container(), | |
) |
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
AnimationController _animationController = | |
AnimationController(vsync: this, duration: Duration(seconds: 1)); | |
Animation _animation = Tween(begin: 0.0, end: -0.15).animate( | |
CurvedAnimation(curve: Curves.ease, parent: _animationController)); |
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
Animation transformAnimation = BorderRadiusTween( | |
begin: BorderRadius.circular(125.0), | |
end: BorderRadius.circular(0.0).animate(type_of_animation); | |
/////////////// OR /////////////// | |
Animation transformAnimation = Tween<BorderRadius>( | |
begin: BorderRadius.circular(125.0), | |
end: BorderRadius.circular(0.0).animate(type_of_animation); |
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
Animation _animation = Tween(begin: 0.0, end: 1.0).animate(type_of_animation); |
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 HomeScreen extends StatefulWidget { | |
@override | |
_HomeScreenState createState() => _HomeScreenState(); | |
} | |
class _HomeScreenState extends State<HomeScreen> | |
with SingleTickerProviderStateMixin { | |
AnimationController _animationController; | |
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 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/foundation.dart' show SynchronousFuture; | |
class AppLocalizations { | |
AppLocalizations(this.locale); | |
final Locale locale; |
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 void setLocale(BuildContext context, Locale newLocale) async { | |
_MyAppState state = context.ancestorStateOfType(TypeMatcher<_MyAppState>()); | |
state.setState(() { | |
state.locale = newLocale; | |
}); | |
} |