change readme
This commit is contained in:
parent
cfb4611ec5
commit
3f068f246e
17
README.md
17
README.md
|
@ -1,16 +1,3 @@
|
||||||
# slothmu
|
# loris
|
||||||
|
|
||||||
A new Flutter project.
|
the best fedi client for gotosocial and mastodon (soon)(i promise)
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
This project is a starting point for a Flutter application.
|
|
||||||
|
|
||||||
A few resources to get you started if this is your first Flutter project:
|
|
||||||
|
|
||||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
|
||||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
|
||||||
|
|
||||||
For help getting started with Flutter development, view the
|
|
||||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
|
||||||
samples, guidance on mobile development, and a full API reference.
|
|
||||||
|
|
|
@ -1,20 +1,32 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import '../settings.dart' as settings;
|
import '../settings.dart' as settings;
|
||||||
import '../../global.dart' as global;
|
import '../../global.dart' as global;
|
||||||
|
|
||||||
|
class Timeline {}
|
||||||
|
|
||||||
Future<http.Response> getTimelineFromServer() async {
|
Future<http.Response> getTimelineFromServer() async {
|
||||||
|
const limit = 4;
|
||||||
final token = await settings.loadToken();
|
final token = await settings.loadToken();
|
||||||
final baseUrl = await settings.loadInstanceUrl();
|
final baseUrl = await settings.loadInstanceUrl();
|
||||||
final url = Uri(
|
final url = Uri(
|
||||||
scheme: "https",
|
scheme: "https",
|
||||||
host: baseUrl,
|
host: baseUrl,
|
||||||
path: "/api/v1/timelines/home",
|
path: "/api/v1/timelines/home",
|
||||||
|
queryParameters: {"limit": limit.toString()},
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, String> headers = {"Authorization": "Bearer $token"};
|
Map<String, String> headers = {"Authorization": "Bearer $token"};
|
||||||
headers.addAll(global.defaultHeaders);
|
headers.addAll(global.defaultHeaders);
|
||||||
|
|
||||||
final response = await http.get(url, headers: headers);
|
final response = await http.get(url, headers: headers);
|
||||||
|
final json = jsonDecode(response.body);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while (i < limit) {
|
||||||
|
print(json[i]["id"]);
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ class _TimelineState extends State<Timeline> {
|
||||||
Future fetchMore() async {
|
Future fetchMore() async {
|
||||||
loading = true;
|
loading = true;
|
||||||
final response = await tl.getTimelineFromServer();
|
final response = await tl.getTimelineFromServer();
|
||||||
print(response.body);
|
|
||||||
print(response.statusCode);
|
|
||||||
setState(() {
|
setState(() {
|
||||||
if (children.isNotEmpty) {
|
if (children.isNotEmpty) {
|
||||||
children.removeAt(children.length - 1);
|
children.removeAt(children.length - 1);
|
||||||
|
|
Loading…
Reference in New Issue