37 lines
991 B
Dart
37 lines
991 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class SettingItem extends StatefulWidget {
|
|
|
|
final String name;
|
|
final String value;
|
|
final String title;
|
|
final Function onTap;
|
|
|
|
SettingItem({Key key, this.name, this.value, this.onTap, this.title }) : super(key: key);
|
|
|
|
@override
|
|
_SettingItemState createState() => _SettingItemState();
|
|
}
|
|
|
|
class _SettingItemState extends State<SettingItem> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
child: ListTile(
|
|
title: Text(widget.title),
|
|
subtitle: Text.rich(
|
|
TextSpan(
|
|
text: widget.name,
|
|
style: TextStyle(fontWeight: FontWeight.w500),
|
|
children: <TextSpan>[
|
|
if(widget.value !=null)
|
|
TextSpan(text: ' ${widget.value}', style: TextStyle(fontStyle: FontStyle.italic)),
|
|
],
|
|
)
|
|
),
|
|
trailing: Icon(Icons.chevron_right),
|
|
onTap: widget.onTap,
|
|
),
|
|
);
|
|
}
|
|
} |