forked from ibhavikmakwana/FlutterPlayground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleNameItem.dart
More file actions
79 lines (75 loc) · 2.43 KB
/
ExampleNameItem.dart
File metadata and controls
79 lines (75 loc) · 2.43 KB
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
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
import 'package:flutter_playground/models/ExapmleNames.dart';
import 'package:flutter_playground/values/imports.dart';
import 'package:meta/meta.dart';
/// A [ExampleNameItem] to display a [ExampleNames].
class ExampleNameItem extends StatelessWidget {
final ExampleNames exampleNames;
final ValueChanged<ExampleNames> onTap;
const ExampleNameItem({
Key key,
@required this.exampleNames,
this.onTap,
})
: assert(exampleNames != null),
super(key: key);
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.circular(4.0),
child: Card(
elevation: 4.0,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(0.0)),
),
child: Container(
decoration: BoxDecoration(
border: Border(
left: BorderSide(
width: 4.0,
color: Theme
.of(context)
.accentColor,
),
),
),
child: InkWell(
onTap: () {
Navigator.pushNamed(context, "/${exampleNames.title}");
FirebaseAnalytics().setCurrentScreen(screenName: exampleNames.title);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Container(
margin:
EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0),
child: Text(
exampleNames.title,
softWrap: true,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.chevron_right,
),
),
],
),
),
),
),
);
}
}