Shitty SizedBox hack, that I'd rather not have in production
This commit is contained in:
parent
4350f954a0
commit
c010047887
1 changed files with 31 additions and 17 deletions
|
@ -12,32 +12,46 @@ import 'package:gophershy/gopherlib.dart';
|
|||
class GopherText extends StatelessWidget {
|
||||
|
||||
final LoadedGopherItem item;
|
||||
final ScrollController controller = ScrollController();
|
||||
|
||||
const GopherText(this.item, {super.key});
|
||||
GopherText(this.item, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: Figure out how to stop line wrap
|
||||
// TODO: figure out how to switch between line wrap and no wrap
|
||||
return ListView.builder(
|
||||
itemCount: item.data?.length,
|
||||
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
|
||||
return SizedBox(
|
||||
width: 4000,
|
||||
child: SingleChildScrollView(
|
||||
controller: controller,
|
||||
scrollDirection: Axis.horizontal,
|
||||
// Really shitty hack that works half way
|
||||
// but leaves shitton of space on the right
|
||||
child: SizedBox(
|
||||
width: 4000,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: item.data?.length,
|
||||
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: MediaWidget with option for displaying images, maybe playing WAVs?
|
||||
|
|
Loading…
Reference in a new issue