# BorderText {{tag>flutter border text}} import 'package:flutter/material.dart'; class BorderText extends StatelessWidget { const BorderText(this.text, {super.key, this.title, this.border = false}); final dynamic text; final String? title; final bool border; @override Widget build(BuildContext context) { String text = (this.text == null) ? "Null" : this.text.toString(); if (title != null) { text = "$title: $text"; } return Container( margin: const EdgeInsets.all(2.0), padding: const EdgeInsets.symmetric(horizontal: 10.0), decoration: border ? BoxDecoration( color: Colors.white.withOpacity(0.5), backgroundBlendMode: BlendMode.srcOver, border: Border.all(color: Colors.blueAccent), borderRadius: const BorderRadius.all(Radius.circular(20))) : null, child: Text(text, overflow: TextOverflow.ellipsis), ); } }