Program/Flutter

Flutter Card Widget Sample

하랑파파♡ 2019. 10. 2. 18:21
728x90
반응형
SMALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import 'package:flutter/material.dart';
 
void main() => runApp(MyApp());
 
class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}
 
class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Center(
          child: Container(
            width: 270.0,
            height: 270.0,
            child: Card(
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(15.0),
              ),
              color: Colors.purple,
              elevation: 10,
              child: Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Expanded(
                    flex: 2,
                    child: Container(
                      decoration: BoxDecoration(
                        border: Border.all(
                          color: Colors.white,
                        ),
                      ),
                      child: Align(
                        alignment: Alignment.center,
                        child: ListTile(
                          leading: Icon(Icons.album, size: 70),
                          title: Text('Heart Shaker',
                              style: TextStyle(color: Colors.white)),
                          subtitle:
                          Text('TWICE', style: TextStyle(color: Colors.white)),
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 1,
                    child: Container(
                      decoration: BoxDecoration(
                        border: Border.all(
                          color: Colors.white,
                        ),
                      ),
                      child: Align(
                        alignment: Alignment.bottomCenter,
                        child: ButtonTheme.bar( // ignore: deprecated_member_use
                          child: ButtonBar(
                            alignment: MainAxisAlignment.center,
                            children: <Widget>[
                              FlatButton(
                                child: const Text('Edit',
                                    style: TextStyle(color: Colors.white)),
                                onPressed: () {},
                              ),
                              FlatButton(
                                child: const Text('Delete',
                                    style: TextStyle(color: Colors.white)),
                                onPressed: () {},
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
 
728x90
반응형
LIST

'Program > Flutter' 카테고리의 다른 글

Mac Flutter 개발 환경  (0) 2020.07.15
Dart 기본 문법  (0) 2020.07.08
SingleChildScrollView  (0) 2019.09.02
Flutter Focus on a Text Field  (0) 2018.11.14
Flutter Create and style a text field  (0) 2018.11.14