import 'package:flutter/material.dart';
import 'package:home_page/listbeasiswa.dart';
List<Beasiswa> beasiswa = [
const Beasiswa(id: "1",name: "Politeknik Elektronika Negeri Surabaya", description: "Beasiswa Tahun 2019 Tanpa Ribet, Ambil yuk secepatnya ! Gratis lho.", image: "assets/images/pens.png"),
const Beasiswa(id: "2",name: "Universitas Widya Kartika", description: "Beasiswa Tahun 2019 Tanpa Ribet, Ambil yuk secepatnya ! Gratis lho.", image: "assets/images/uwika.png"),
const Beasiswa(id: "3",name: "Beasiswa PPA", description: "Beasiswa Tahun 2019 Tanpa Ribet, Ambil yuk secepatnya ! Gratis lho.", image: "assets/images/ppa.png"),
const Beasiswa(id: "4",name: "Jawa Pos Exellence Capital", description: "Beasiswa Tahun 2019 Tanpa Ribet, Ambil yuk secepatnya ! Gratis lho.", image: "assets/images/jawapos.png"),
];
class Wrow extends StatelessWidget{
static Beasiswa beasiswa;
Wrow(beasiswa);
final wImage = new Container(
height: 90.0,
width: 90.0,
margin: new EdgeInsets.symmetric(
vertical: 16.0,
),
alignment: FractionalOffset.centerLeft,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
fit: BoxFit.fill,
image: new AssetImage(beasiswa.image),
)
),
/*child: new Image(
image: new AssetImage("assets/images/pens.png"),
height: 92.0,
width: 92.0,
),*/
);
final wCard =new Container(
height: 124.0,
decoration: new BoxDecoration(
color: new Color(0xFFEEE6FF),
shape: BoxShape.rectangle,
borderRadius: new BorderRadius.circular(8.0),
boxShadow: <BoxShadow>[
new BoxShadow(
color: Colors.black12,
blurRadius: 10.0,
offset: new Offset(0.0, 10.0)
)
]
),
);
final baseTextStyle = TextStyle(
fontFamily: 'Open Sans'
);
final headerTextStyle = baseTextStyle.copyWith(
color: const Colors.black,
fontSize: 18.0,
fontWeight: FontWeight.w600
); // ERROR baseTextStyle only static members can be accessed in initializers
@override
Widget build(BuildContext context) {
return new Container(
margin: const EdgeInsets.symmetric(
vertical: 16.0,
horizontal: 24.0,
),
child: new Stack(
children: <Widget>[
wCard,
wImage,
],
),
);
}
}
答案 0 :(得分:0)
将卡的声明移至build
@override
Widget build(BuildContext context) {
final wImage = new Container(
height: 90.0,
width: 90.0,
margin: new EdgeInsets.symmetric(
vertical: 16.0,
),
// etc
return new Container(
// etc