29 lines
632 B
Dart
29 lines
632 B
Dart
|
|
import 'package:flutter/cupertino.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:mnemo_cards/widgets/switch_button.dart';
|
||
|
|
|
||
|
|
class SwitchTile extends StatelessWidget {
|
||
|
|
final bool value;
|
||
|
|
final void Function(bool)? onChanged;
|
||
|
|
final String text;
|
||
|
|
|
||
|
|
SwitchTile({
|
||
|
|
required this.text,
|
||
|
|
required this.value,
|
||
|
|
this.onChanged,
|
||
|
|
});
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Row(
|
||
|
|
children: [
|
||
|
|
Expanded(child: Text(text, overflow: TextOverflow.ellipsis,)),
|
||
|
|
SwitchButton(
|
||
|
|
value: value,
|
||
|
|
onChanged: onChanged ?? (v) {},
|
||
|
|
),
|
||
|
|
],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|