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/rendering.dart'; | |
import 'package:flutter/widgets.dart'; | |
class AnimatedEdgeSlide extends SingleChildRenderObjectWidget { | |
const AnimatedEdgeSlide({ | |
required Widget super.child, | |
required this.positionAnimation, | |
super.key, | |
}); |
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 RecommendedBadge extends StatelessWidget { | |
const RecommendedBadge({super.key}); | |
@override | |
Widget build(BuildContext context) => DecoratedBox( | |
decoration: BoxDecoration( | |
color: Colors.of(context).tertiary, | |
borderRadius: BorderRadius.circular(4), | |
), | |
child: Padding( |
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 'dart:async'; | |
import 'package:flutter/material.dart'; | |
typedef ValueBuilder<T> = Widget Function(BuildContext context, T value); | |
class GoodForm extends StatefulWidget { | |
const GoodForm({ | |
required this.builder, | |
super.key, |
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 'dart:async'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MainApp()); | |
} | |
class UsernameValidator { | |
final UserRepository _userRepository; |
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 'dart:convert'; | |
void main() { | |
final johnJson = '{"name": "John Doe"}'; | |
final john = getUser(johnJson); | |
final wrongJson = '{"name": "John Doe}'; | |
// this raises FormatException |
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
void main() { | |
try { | |
loadPage(); | |
} catch (e, stackTrace) { | |
print('Stack Trace: $stackTrace'); | |
} | |
} | |
void loadPage() { | |
loadHeader(); |
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
void main() { | |
try { | |
loadPage(); | |
} catch (e, stackTrace) { | |
print('Stack Trace: $stackTrace'); | |
} | |
} | |
void loadPage() { | |
loadHeader(); |
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
void main() { | |
try { | |
sendPost(); | |
// on without catch clause | |
} on LackOfPrivilegesException { | |
print("You don't have enough privileges."); | |
// on with catch clause | |
} on ValidationException catch (e) { | |
print('Please verify entered fields: ${e.fields}'); | |
// general catch clause |
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_svg/flutter_svg.dart'; | |
import 'package:popups_showcase/popup.dart'; | |
void main() { | |
runApp(const MainApp()); | |
} | |
class MainApp extends StatelessWidget { | |
const MainApp({super.key}); |
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'; | |
/// A widget that shows a popup relative to a target widget. | |
/// | |
/// The popup is declaratively shown/hidden using an [OverlayPortalController]. | |
/// | |
/// It is positioned relative to the target widget using the [followerAnchor] and [targetAnchor] properties. | |
class Popup extends StatefulWidget { | |
const Popup({ | |
required this.child, |
NewerOlder