mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-05-17 21:15:54 +08:00
🚧 remove new keyword to get inline with dart 2 code standard.
This commit is contained in:
@ -2,23 +2,23 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class MyGridView {
|
||||
Card getStructuredGridCell(name, image) {
|
||||
return new Card(
|
||||
return Card(
|
||||
elevation: 1.5,
|
||||
child: new Column(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
verticalDirection: VerticalDirection.down,
|
||||
children: <Widget>[
|
||||
new Image(image: new AssetImage('data_repo/img/' + image)),
|
||||
new Center(
|
||||
child: new Text(name),
|
||||
Image(image: AssetImage('data_repo/img/' + image)),
|
||||
Center(
|
||||
child: Text(name),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
GridView build() {
|
||||
return new GridView.count(
|
||||
return GridView.count(
|
||||
primary: true,
|
||||
padding: const EdgeInsets.all(1.0),
|
||||
crossAxisCount: 2,
|
||||
|
@ -1,20 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grid_layout/gridview.dart';
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(MyApp());
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
final MyGridView myGridView = new MyGridView();
|
||||
final MyGridView myGridView = MyGridView();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new MaterialApp(
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
// Here we take the value from the MyHomePage object that was created by
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: new Text("GridView Example"),
|
||||
title: Text("GridView Example"),
|
||||
),
|
||||
body: myGridView.build(),
|
||||
),
|
||||
|
Reference in New Issue
Block a user