Skip to content

Instantly share code, notes, and snippets.

@flutter-clutter
flutter-clutter / particle.dart
Created July 18, 2020 09:14
Animated sparkler in Flutter
import 'dart:math';
import 'package:flutter/material.dart';
class Particle extends StatefulWidget {
Particle({
this.duration = const Duration(milliseconds: 300)
});
final Duration duration;
@override
@flutter-clutter
flutter-clutter / gradient_border_container.dart
Last active July 22, 2024 09:38
A flutter widget that gives the given child a configurable gradient border (used and explained on https://www.flutterclutter.dev/flutter/tutorials/how-to-add-a-border-to-a-widget/2020/587/)
import 'package:flutter/material.dart';
class GradientBorderContainer extends StatelessWidget {
GradientBorderContainer({
@required gradient,
@required this.child,
@required this.onPressed,
this.strokeWidth = 4,
this.borderRadius = 64,
this.padding = 16,
@flutter-clutter
flutter-clutter / overlay_with_hole.dart
Created June 27, 2020 12:08
Flutter overlay with a hole
import 'package:flutter/material.dart';
class OverlayWithHole extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Flutterclutter: Holes")),
body: _getExperimentOne()
);
}
import 'dart:convert';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class AppLocalizations {
AppLocalizations(this.locale);
final Locale fallbackLocale = Locale('en');
static AppLocalizations of(BuildContext context) {
import 'dart:convert';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class AppLocalizations {
AppLocalizations(this.locale);
static AppLocalizations of(BuildContext context) {
return Localizations.of<AppLocalizations>(context, AppLocalizations);
Container(
child: CircularProgressIndicator(),
width: 32,
height: 32
);
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
void hideOpenDialog() {
Navigator.of(context).pop();
}
void showLoadingIndicator([String text]) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
content: LoadingIndicator(
text: text
),
);
},
Container(
padding: EdgeInsets.all(16),
color: Colors.black.withOpacity(0.8),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
_getLoadingIndicator(),
_getHeading(),
_getText('Text')