Compare commits

...

3 commits

2 changed files with 32 additions and 18 deletions

View file

@ -129,7 +129,7 @@ class _GopherLoaderState extends State<GopherLoader> {
builder: (cont, snap) { builder: (cont, snap) {
print("${snap.connectionState}"); print("${snap.connectionState}");
if (snap.connectionState != ConnectionState.done) { if (snap.connectionState != ConnectionState.done) {
return const CircularProgressIndicator(); return const Center(child: CircularProgressIndicator());
} else { } else {
if (snap.hasData) { if (snap.hasData) {
print( print(

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 Text( 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.w400, 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?