Shitty SizedBox hack, that I'd rather not have in production

This commit is contained in:
Felisp 2024-11-09 02:29:23 +01:00
parent 4350f954a0
commit c010047887

View file

@ -12,32 +12,46 @@ import 'package:gophershy/gopherlib.dart';
class GopherText extends StatelessWidget { class GopherText extends StatelessWidget {
final LoadedGopherItem item; final LoadedGopherItem item;
final ScrollController controller = ScrollController();
const GopherText(this.item, {super.key}); GopherText(this.item, {super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// TODO: Figure out how to stop line wrap // TODO: Figure out how to stop line wrap
// TODO: figure out how to switch between line wrap and no wrap // TODO: figure out how to switch between line wrap and no wrap
return ListView.builder( return SizedBox(
itemCount: item.data?.length, width: 4000,
itemBuilder: (context, int n) { child: SingleChildScrollView(
return SelectableText( controller: controller,
utf8.decode(item.data![n], allowMalformed: true), scrollDirection: Axis.horizontal,
style: const TextStyle( // Really shitty hack that works half way
fontFamily: "SourceCodePro", // but leaves shitton of space on the right
fontWeight: FontWeight.w600, child: SizedBox(
height: 1.0, width: 4000,
// Might need to be tuned for ASCII art child: ListView.builder(
letterSpacing: 1, shrinkWrap: true,
wordSpacing: 1, itemCount: item.data?.length,
overflow: TextOverflow.clip itemBuilder: (context, int n) {
return SelectableText(
utf8.decode(item.data![n], allowMalformed: true),
style: const TextStyle(
fontFamily: "SourceCodePro",
fontWeight: FontWeight.w600,
height: 1.0,
// Might need to be tuned for ASCII art
letterSpacing: 1,
wordSpacing: 1,
overflow: TextOverflow.clip
),
);
},
),
), ),
); ),
},
); );
}
} }
}
//TODO: BinaryWidget with option of downloading it //TODO: BinaryWidget with option of downloading it
//TODO: MediaWidget with option for displaying images, maybe playing WAVs? //TODO: MediaWidget with option for displaying images, maybe playing WAVs?