initial commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/theme_x.dart';
|
||||
|
||||
/// A technical value — compose file path, hostname, id, URL — rendered in
|
||||
/// the monospace data face so it reads as "an exact string", distinct from
|
||||
/// prose. Use for anything a user might copy-paste or match against a log.
|
||||
class MonoText extends StatelessWidget {
|
||||
const MonoText(
|
||||
this.value, {
|
||||
super.key,
|
||||
this.small = false,
|
||||
this.color,
|
||||
this.maxLines = 1,
|
||||
this.overflow = TextOverflow.ellipsis,
|
||||
});
|
||||
|
||||
final String value;
|
||||
final bool small;
|
||||
final Color? color;
|
||||
final int? maxLines;
|
||||
final TextOverflow overflow;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final base = small ? context.dataStyles.dataMonoSmall : context.dataStyles.dataMono;
|
||||
return Text(
|
||||
value,
|
||||
maxLines: maxLines,
|
||||
overflow: overflow,
|
||||
style: color == null ? base : base.copyWith(color: color),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user