This file contains 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:event_hire/utils/styles.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
class CustomTextField extends StatelessWidget { | |
final String hint; | |
final TextEditingController textEditingController; | |
final TextInputType keyboardType; | |
final errorText; | |
final bool obscureText; |
This file contains 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 CountDownTimer extends StatefulWidget { | |
@override | |
_CountDownTimerState createState() => _CountDownTimerState(); | |
} | |
class _CountDownTimerState extends State<CountDownTimer> | |
with TickerProviderStateMixin { | |
AnimationController controller; | |
String get timerString { |
This file contains 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
return Scaffold( | |
backgroundColor: Colors.white10, | |
body: AnimatedBuilder( | |
animation: controller, | |
builder: (context, child) { | |
return Padding( | |
padding: EdgeInsets.all(8.0), | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ |
This file contains 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 CustomTimerPainter extends CustomPainter { | |
CustomTimerPainter({ | |
this.animation, | |
this.backgroundColor, | |
this.color, | |
}) : super(repaint: animation); | |
final Animation<double> animation; | |
final Color backgroundColor, color; |
This file contains 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
@override | |
Widget build(BuildContext context) { | |
return AnimatedBuilder( | |
animation: _animationController, | |
builder: (context, child) { | |
return Container( | |
width: 70.0, | |
height: 35.0, | |
decoration: BoxDecoration( | |
borderRadius: BorderRadius.circular(20.0), |
This file contains 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 _circleAnimation; | |
AnimationController _animationController; | |
@override | |
void initState() { | |
super.initState(); | |
_animationController = | |
AnimationController(vsync: this, duration: Duration(milliseconds: 60)); | |
_circleAnimation = AlignmentTween( | |
begin: widget.value ? Alignment.centerRight : Alignment.centerLeft, |
This file contains 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
name: custom_switch | |
description: Beautiful Custom Switch created with Flutter. | |
version: 0.0.1 | |
author: Mohak Gupta <mohak1283@gmail.com> | |
homepage: https://github.com/mohak1283/CustomSwitch |
This file contains 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:custom_switch/custom_switch.dart'; | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, |
This file contains 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
custom_switch: | |
path: ../ |
This file contains 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
onTap: () { | |
if (_animationController.isCompleted) { | |
_animationController.reverse(); | |
} else { | |
_animationController.forward(); | |
} | |
widget.value == false | |
? widget.onChanged(true) | |
: widget.onChanged(false); | |
}, |
NewerOlder