Skip to content

Instantly share code, notes, and snippets.

@mmanflori
Created February 3, 2019 10:14
Show Gist options
  • Save mmanflori/ddee62c557af94a1e4e9d1759115c6f8 to your computer and use it in GitHub Desktop.
Save mmanflori/ddee62c557af94a1e4e9d1759115c6f8 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
boxDeco(double aA,double bB){
dynamic boxDeco = new BoxDecoration(
border: new Border.all(
color:Colors.black,
width: 2.0,
style: BorderStyle.solid,
),
color: Colors.blue,
borderRadius: BorderRadius.all(
new Radius.circular(
10.0
)
),
boxShadow: [new BoxShadow(
color: Colors.grey,
offset: new Offset(aA, bB),
blurRadius: 5.0,
)],
);
return boxDeco;
}
Shadow b = new Shadow(
color: Colors.grey[200],
offset: Offset(3.0, 3.0),
blurRadius: 3.0,
);
Shadow d = new Shadow();
import 'package:flutter/material.dart';
import 'library.dart';
void main() => runApp(MeineApp());
class MeineApp extends StatefulWidget {
@override
_MeineAppState createState() => _MeineAppState();
}
class _MeineAppState extends State<MeineApp> {
double aA=0;
double bB=0;
List<Shadow> schatten = [d];
List<Shadow> schatten2 = [b];
dynamic mneueBox=boxDeco(0.0, 0.0);
void neueBox(){
setState(() {
aA=aA + 1.0;
bB=bB + 1.0;
mneueBox=boxDeco(aA, bB);
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "StateDemo",
home: new Scaffold(
body: new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Center(
child: new Container(
width: 50.0,
height: 50.0,
child: Center(child: new Text("Hallo"),),
decoration: mneueBox,
),
),
new IconButton(
color: Colors.deepOrange,
icon:Icon(Icons.star) ,
onPressed:neueBox,
),
new Text(
"Guten Morgen liebe Sorgen :-)",
style: TextStyle(
color: Colors.black,
fontSize: 20.0,
fontWeight: FontWeight.normal,
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.solid,
shadows: Shadow.lerpList(schatten, schatten2, 0.8),
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment