class MyHome extends StatefulWidget {
@override
_MyHomeState createState() => _MyHomeState();
}
class _MyHomeState extends State<MyHome> {
GlobalKey<ScaffoldState> _scaffold = GlobalKey<ScaffoldState>();
bool _data = false;
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffold,
drawer: Menu(),
appBar: AppBar(
leading: SvgPicture.asset('assets/images/sirket-amblem.svg', width: 10.0,),
centerTitle: true,title: Text('Anasayfa', style: TextStyle(color: Colors.indigo, fontWeight : FontWeight.w700,),),
actions: <Widget>[
IconButton(
onPressed: () {
_scaffold.currentState.openDrawer();
},
icon: Icon(Icons.menu,
color: Colors.indigo,),),
IconButton( onPressed: () {
_data = false;
setState(() {});
AncWidget.of(context).transaction.request().then((request){
_data = request;
setState(() {});
});
},
icon: Icon(Icons.refresh,
color: Colors.indigo,),)
],
),
body: _data
? Container(
child : SingleChildScrollView(child: Column (
mainAxisAlignment: MainAxisAlignment.start,
children:[
Container(
height: 200.0,
width: double.maxFinite,
child: MainSlider(), ),
Padding(
padding: EdgeInsets.only(top: 15.0),
child : Image.asset('assets/images/main_chart.png', width: 500.0, height: 222.0,),),
GridView.count(
crossAxisCount: 3,
mainAxisSpacing: 9.0,
crossAxisSpacing: 9.0,
childAspectRatio: 1.2,
physics: NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 10.0, bottom: 0.0),
children: List.generate(choices.length, (index) {
return Center(
child: ChoiceCard(choice: choices[index]),
);
}
)
)
],
)
,)
)
: Center(child: CircularProgressIndicator(),),
);
}
}
class Choice {
const Choice ({this.title, this.icon});
final String title;
final String icon;
}
const List<Choice> choices = const <Choice>[
const Choice(title: 'YÖNETİM', icon: 'assets/images/icons/menu/kurumsal.svg'),
const Choice(title: 'SENET', icon: 'assets/images/icons/menu/hisse-senedi.svg'),
const Choice(title: 'FİNANSAL', icon: 'assets/images/icons/menu/finansal-raporlar.svg'),
];
class ChoiceCard extends StatelessWidget {
const ChoiceCard({Key key, this.choice}) : super(key: key);
final Choice choice;
@override
Widget build(BuildContext context) {
return Card(
color: Color(0xFFE6E8F0),
child: Center(child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(child: SvgPicture.asset(choice.icon, color: Color(0xFF324684), width: 35.0,)),
Padding(padding: EdgeInsets.only(left: 7.0, right: 7.0, bottom: 9.0), child : Text(choice.title ,style: TextStyle(fontSize: 10.0, color: Color(0xFF324684), fontFamily: 'ProximaNova-Regular', fontWeight: FontWeight.w700), textAlign: TextAlign.center,)),
]
),
)
);
}
}
//(Another Code (working but no scrollView. I need ScrollView))
/*
Expanded(
child :Container(
height: 200.0,
width: double.maxFinite,
child: MainSlider(),
),
),
Expanded(
child : Padding(
padding: EdgeInsets.only(top: 15.0),
child : Image.asset('assets/images/main_chart.png', width: 500.0, height: 222.0,),)
),
//Padding(padding: EdgeInsets.only(top: 10.0),),
Expanded(
child : GridView.count(
crossAxisCount: 3,
mainAxisSpacing: 9.0,
crossAxisSpacing: 9.0,
childAspectRatio: 1.2,
physics: NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 10.0, bottom: 0.0),
children: List.generate(choices.length, (index) {
return Center(
child: ChoiceCard(choice: choices[index]),
);
}
)
)
),
*/
Я хочу добавить ScrolView во Flutter, но у меня есть GridView. Как я могу добавить ScrollView на страницу, когда у меня есть GridView? Я создал GridView для ButtonList для подобного меню на странице myhome.
Пример
. . .
. . .
. . .
подобной таблицы, подобной GridView.