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
interface IRouteChangeProps { | |
routeChangeFn: () => boolean | |
} | |
const useRouteChange = (props: IRouteChangeProps) => { | |
const router = useRouter(); | |
const routeChangeStart = () => { | |
const close_res = props.routeChangeFn(); | |
if (!close_res) { | |
router.events.emit('routeChangeError', router.asPath, { shallow: true }); | |
throw 'Abort route change. Please ignore this error.'; |
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:flutter/material.dart'; | |
import 'package:flutter/gestures.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
scrollBehavior: AppScrollBehavior(), |
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:flutter/material.dart'; | |
//create by Amirreza salimi https://gist.github.com/amirrezasalimi/48132d9330f53672a894829961cb727b/ | |
class ToggleInput extends StatefulWidget { | |
@override | |
ToggleInputState createState() => ToggleInputState(); | |
} | |
class ToggleInputState extends State<ToggleInput> | |
with TickerProviderStateMixin { | |
bool isHidden = false; |