rename to loris
This commit is contained in:
parent
05eef7f783
commit
30de8189bc
8 changed files with 104 additions and 19 deletions
|
@ -1 +1,7 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
|
||||
class Thread {}
|
||||
|
||||
class Post {}
|
||||
|
||||
class Timeline {}
|
||||
|
|
|
@ -34,11 +34,7 @@ class MakePostActionBar extends StatelessWidget {
|
|||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
icon: Icon(Icons.cancel),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: null,
|
||||
icon: Icon(Icons.save),
|
||||
icon: const Icon(Icons.cancel),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/painting.dart';
|
||||
|
||||
const String name = "slothmu";
|
||||
const String name = "loris";
|
||||
const String version = "v0.1 'not even alpha'";
|
||||
const String useragent = "$name/$version";
|
||||
const String website = "https://git.kittycat.homes/zoe/slothmu";
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
"timeline" : "timeline",
|
||||
"chat": "chat",
|
||||
"notifications": "benachrichtigungen",
|
||||
"settings": "einstellungen"
|
||||
"settings": "einstellungen",
|
||||
"show": "zeigen",
|
||||
"hide": "verstecken"
|
||||
}
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
"timeline" : "timeline",
|
||||
"chat": "chat",
|
||||
"notifications": "notifications",
|
||||
"settings": "settings"
|
||||
"settings": "settings",
|
||||
"show": "show",
|
||||
"hide": "hide"
|
||||
}
|
||||
|
|
@ -1,13 +1,80 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:slothmu/partials/post.dart';
|
||||
import 'package:localization/localization.dart';
|
||||
import '../../business_logic/settings.dart' as settings;
|
||||
import 'package:slothmu/partials/thread.dart';
|
||||
|
||||
Widget timeline(context) {
|
||||
return Container(
|
||||
child: ListView(
|
||||
class Timeline extends StatefulWidget {
|
||||
const Timeline({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<Timeline> createState() => _TimelineState();
|
||||
}
|
||||
|
||||
class _TimelineState extends State<Timeline> {
|
||||
final controller = ScrollController();
|
||||
List<Widget> children = [];
|
||||
bool loading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
fetchMore();
|
||||
controller.addListener(() {
|
||||
if (controller.position.maxScrollExtent <= controller.offset &&
|
||||
!loading) {
|
||||
fetchMore();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future fetchMore() async {
|
||||
loading = true;
|
||||
final token = await settings.loadAuthCode();
|
||||
setState(() {
|
||||
if (children.isNotEmpty) {
|
||||
children.removeAt(children.length - 1);
|
||||
}
|
||||
children.addAll([Thread()]);
|
||||
children.add(
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
fetchMore();
|
||||
},
|
||||
icon: const Icon(Icons.more_horiz),
|
||||
label: Text("load-more".i18n()),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.separated(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: controller,
|
||||
itemBuilder: (context, index) {
|
||||
return children[index];
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
return const Divider(
|
||||
color: Colors.transparent,
|
||||
);
|
||||
},
|
||||
itemCount: children.length,
|
||||
padding: const EdgeInsets.fromLTRB(24, 0, 24, 64),
|
||||
addAutomaticKeepAlives: false,
|
||||
children: [Thread(), Thread(), Thread()],
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class _MainScaffoldState extends State<MainScaffold> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screens = [
|
||||
timeline(context),
|
||||
const Timeline(),
|
||||
chat(context),
|
||||
notifications(context),
|
||||
settings(context),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:localization/localization.dart';
|
||||
|
||||
class Post extends StatefulWidget {
|
||||
const Post({Key? key}) : super(key: key);
|
||||
|
@ -61,6 +62,8 @@ class PostBody extends StatefulWidget {
|
|||
|
||||
class _PostBodyState extends State<PostBody> {
|
||||
bool visible = false;
|
||||
String cwButtonText = "show".i18n();
|
||||
Icon cwButtonIcon = const Icon(Icons.visibility);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
|
@ -69,14 +72,23 @@ class _PostBodyState extends State<PostBody> {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextButton.icon(
|
||||
Text(
|
||||
"sdkfjksdjfkd sldkjfksdjf dskfjsdkfjkds skdfjksdjfisdujfiosdhfjkldsfh sldkfjksdjfksdjfklsdjf"),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
visible = !visible;
|
||||
if (visible) {
|
||||
cwButtonIcon = const Icon(Icons.visibility_off);
|
||||
cwButtonText = "hide".i18n();
|
||||
} else {
|
||||
cwButtonText = "show".i18n();
|
||||
cwButtonIcon = const Icon(Icons.visibility);
|
||||
}
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.warning),
|
||||
label: const Text("warning")),
|
||||
icon: cwButtonIcon,
|
||||
label: Text(cwButtonText)),
|
||||
Visibility(
|
||||
visible: visible,
|
||||
child: RichText(
|
||||
|
|
Loading…
Reference in a new issue