Skip to content

Instantly share code, notes, and snippets.

@knaeckeKami
Created September 14, 2022 13:38
Show Gist options
  • Save knaeckeKami/65b1ba35a71e2501ecf61158d363944d to your computer and use it in GitHub Desktop.
Save knaeckeKami/65b1ba35a71e2501ecf61158d363944d to your computer and use it in GitHub Desktop.
fluttering-destiny-7433

fluttering-destiny-7433

Created with <3 with dartpad.dev.

import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light().copyWith(
scaffoldBackgroundColor: darkBlue,
sliderTheme: SliderThemeData(
showValueIndicator: ShowValueIndicator.always,
),
),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatefulWidget {
@override
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
double offsetX = 0;
double offsetY = 0;
double blur = 0;
double spread = 0;
Color color = Colors.grey;
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: const EdgeInsets.all(16.0),
child: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
border:
Border.fromBorderSide(BorderSide(color: Colors.black45)),
boxShadow: [
BoxShadow(
offset: Offset(offsetX, offsetY),
color: color,
blurRadius: blur,
spreadRadius: spread,
)
]),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
textBaseline: TextBaseline.alphabetic,
columnWidths: const <int, TableColumnWidth>{
0: IntrinsicColumnWidth(),
1: FlexColumnWidth(),
},
children: [
TableRow(
children: [
Text("Offset X: "),
Slider(
value: offsetX,
label: offsetX.round().toString(),
min: -10,
max: 10,
onChanged: (x) => setState(() {
offsetX = x;
})),
],
),
TableRow(
children: [
Text("Offset Y: "),
Slider(
value: offsetY,
min: -10,
max: 10,
label: offsetY.round().toString(),
onChanged: (y) => setState(() {
offsetY = y;
}))
],
),
TableRow(
children: [
Text("Blur: "),
Slider(
value: blur,
min: 0,
max: 10,
label: blur.toString(),
onChanged: (b) => setState(() {
blur = b;
}))
],
),
TableRow(
children: [
Text("Spread: "),
Slider(
value: spread,
min: 0,
max: 10,
label: spread.toString(),
onChanged: (s) => setState(() {
spread = s;
}))
],
),
TableRow(
children: [
Text("Red"),
Slider(
value: color.red.toDouble(),
min: 0,
max: 255,
label: color.red.toString(),
onChanged: (r) => setState(() {
color = color.withRed(r.round());
}))
],
),
TableRow(
children: [
Text("Green"),
Slider(
value: color.green.toDouble(),
min: 0,
max: 255,
label: color.green.toString(),
onChanged: (r) => setState(() {
color = color.withGreen(r.round());
}))
],
),
TableRow(
children: [
Text("Blue"),
Slider(
value: color.blue.toDouble(),
min: 0,
max: 255,
label: color.blue.toString(),
onChanged: (r) => setState(() {
color = color.withBlue(r.round());
}))
],
),
TableRow(
children: [
Text("Alpha"),
Slider(
value: color.alpha.toDouble(),
min: 0,
max: 255,
label: color.alpha.toString(),
onChanged: (r) => setState(() {
color = color.withAlpha(r.round());
}))
],
)
],
),
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment