* added dartpad demos and buttons, cards, and text field demos * updated dartpad examples
3.9 KiB
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', debugShowCheckedModeBanner: false, theme: ThemeData( buttonColor: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Card Page'), ); } }
class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override _MyHomePageState createState() => _MyHomePageState(); }
class _MyHomePageState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( automaticallyImplyLeading: false, title: Text(widget.title), ), body: ListView( children: [ Card( clipBehavior: Clip.antiAlias, child: Column( children: [ ListTile( leading: Icon(Icons.arrow_drop_down_circle), title: const Text('Card title 1'), subtitle: Text( 'Secondary Text', style: TextStyle(color: Colors.black.withOpacity(0.6)), ), ), Padding( padding: const EdgeInsets.all(16.0), child: Text( 'Greyhound divisively hello coldly wonderfully marginally far upon excluding.', style: TextStyle(color: Colors.black.withOpacity(0.6)), ), ), ButtonBar( alignment: MainAxisAlignment.start, children: [ FlatButton( textColor: const Color(0xFF6200EE), onPressed: () { // Perform some action }, child: const Text('ACTION 1'), ), FlatButton( textColor: const Color(0xFF6200EE), onPressed: () { // Perform some action }, child: const Text('ACTION 2'), ), ], ), Image.asset('assets/card-sample-image.jpg'), ], ), ), Card( clipBehavior: Clip.antiAlias, child: Column( children: [ ListTile( leading: Icon(Icons.arrow_drop_down_circle), title: const Text('Card title 1'), subtitle: Text( 'Secondary Text', style: TextStyle(color: Colors.black.withOpacity(0.6)), ), ), Padding( padding: const EdgeInsets.all(16.0), child: Text( 'Greyhound divisively hello coldly wonderfully marginally far upon excluding.', style: TextStyle(color: Colors.black.withOpacity(0.6)), ), ), ButtonBar( alignment: MainAxisAlignment.start, children: [ FlatButton( textColor: const Color(0xFF6200EE), onPressed: () { // Perform some action }, child: const Text('ACTION 1'), ), FlatButton( textColor: const Color(0xFF6200EE), onPressed: () { // Perform some action }, child: const Text('ACTION 2'), ), ], ), Image.asset('assets/card-sample-image-2.jpg'), ], ), ), ], ), ); } }