2024-12-18 21:12:24 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
2020-07-27 20:43:58 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:mobile_nebula/services/utils.dart';
|
|
|
|
|
|
|
|
class ConfigItem extends StatelessWidget {
|
|
|
|
const ConfigItem(
|
2022-09-21 20:27:35 +00:00
|
|
|
{Key? key,
|
|
|
|
this.label,
|
|
|
|
required this.content,
|
|
|
|
this.labelWidth = 100,
|
|
|
|
this.crossAxisAlignment = CrossAxisAlignment.center})
|
2020-07-27 20:43:58 +00:00
|
|
|
: super(key: key);
|
|
|
|
|
2022-09-21 20:27:35 +00:00
|
|
|
final Widget? label;
|
2020-07-27 20:43:58 +00:00
|
|
|
final Widget content;
|
|
|
|
final double labelWidth;
|
|
|
|
final CrossAxisAlignment crossAxisAlignment;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-12-19 17:19:46 +00:00
|
|
|
var textStyle;
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
textStyle = Theme.of(context).textTheme.labelLarge!.copyWith(fontWeight: FontWeight.normal);
|
|
|
|
} else {
|
|
|
|
textStyle = CupertinoTheme.of(context).textTheme.textStyle;
|
|
|
|
}
|
|
|
|
|
2020-07-27 20:43:58 +00:00
|
|
|
return Container(
|
|
|
|
color: Utils.configItemBackground(context),
|
2024-12-19 17:19:46 +00:00
|
|
|
padding: EdgeInsets.only(top: 2, bottom: 2, left: 15, right: 20),
|
2020-07-27 20:43:58 +00:00
|
|
|
constraints: BoxConstraints(minHeight: Utils.minInteractiveSize),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: crossAxisAlignment,
|
|
|
|
children: <Widget>[
|
2024-12-19 17:19:46 +00:00
|
|
|
Container(width: labelWidth, child: DefaultTextStyle(style: textStyle, child: Container(child: label))),
|
|
|
|
Expanded(child: DefaultTextStyle(style: textStyle, child: Container(child: content))),
|
2020-07-27 20:43:58 +00:00
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|