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: () { |           onPressed: () { | ||||||
|             Navigator.of(context).pop(); |             Navigator.of(context).pop(); | ||||||
|           }, |           }, | ||||||
|           icon: Icon(Icons.cancel), |           icon: const Icon(Icons.cancel), | ||||||
|         ), |  | ||||||
|         IconButton( |  | ||||||
|           onPressed: null, |  | ||||||
|           icon: Icon(Icons.save), |  | ||||||
|         ), |         ), | ||||||
|       ], |       ], | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| import 'package:flutter/painting.dart'; | import 'package:flutter/painting.dart'; | ||||||
| 
 | 
 | ||||||
| const String name = "slothmu"; | const String name = "loris"; | ||||||
| const String version = "v0.1 'not even alpha'"; | const String version = "v0.1 'not even alpha'"; | ||||||
| const String useragent = "$name/$version"; | const String useragent = "$name/$version"; | ||||||
| const String website = "https://git.kittycat.homes/zoe/slothmu"; | const String website = "https://git.kittycat.homes/zoe/slothmu"; | ||||||
|  |  | ||||||
|  | @ -9,6 +9,8 @@ | ||||||
|     "timeline" : "timeline", |     "timeline" : "timeline", | ||||||
|     "chat": "chat", |     "chat": "chat", | ||||||
|     "notifications": "benachrichtigungen", |     "notifications": "benachrichtigungen", | ||||||
|     "settings": "einstellungen" |     "settings": "einstellungen", | ||||||
|  |     "show": "zeigen", | ||||||
|  |     "hide": "verstecken" | ||||||
| } | } | ||||||
|    |    | ||||||
|  | @ -9,6 +9,8 @@ | ||||||
|     "timeline" : "timeline", |     "timeline" : "timeline", | ||||||
|     "chat": "chat", |     "chat": "chat", | ||||||
|     "notifications": "notifications", |     "notifications": "notifications", | ||||||
|     "settings": "settings" |     "settings": "settings", | ||||||
|  |     "show": "show", | ||||||
|  |     "hide": "hide" | ||||||
| } | } | ||||||
|    |    | ||||||
|  | @ -1,13 +1,80 @@ | ||||||
| import 'package:flutter/material.dart'; | 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'; | import 'package:slothmu/partials/thread.dart'; | ||||||
| 
 | 
 | ||||||
| Widget timeline(context) { | class Timeline extends StatefulWidget { | ||||||
|   return Container( |   const Timeline({Key? key}) : super(key: key); | ||||||
|     child: ListView( | 
 | ||||||
|  |   @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), |       padding: const EdgeInsets.fromLTRB(24, 0, 24, 64), | ||||||
|       addAutomaticKeepAlives: false, |       addAutomaticKeepAlives: false, | ||||||
|       children: [Thread(), Thread(), Thread()], |     ); | ||||||
|     ), |   } | ||||||
|   ); |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ class _MainScaffoldState extends State<MainScaffold> { | ||||||
|   @override |   @override | ||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     final screens = [ |     final screens = [ | ||||||
|       timeline(context), |       const Timeline(), | ||||||
|       chat(context), |       chat(context), | ||||||
|       notifications(context), |       notifications(context), | ||||||
|       settings(context), |       settings(context), | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||||
|  | import 'package:localization/localization.dart'; | ||||||
| 
 | 
 | ||||||
| class Post extends StatefulWidget { | class Post extends StatefulWidget { | ||||||
|   const Post({Key? key}) : super(key: key); |   const Post({Key? key}) : super(key: key); | ||||||
|  | @ -61,6 +62,8 @@ class PostBody extends StatefulWidget { | ||||||
| 
 | 
 | ||||||
| class _PostBodyState extends State<PostBody> { | class _PostBodyState extends State<PostBody> { | ||||||
|   bool visible = false; |   bool visible = false; | ||||||
|  |   String cwButtonText = "show".i18n(); | ||||||
|  |   Icon cwButtonIcon = const Icon(Icons.visibility); | ||||||
|   @override |   @override | ||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     return Container( |     return Container( | ||||||
|  | @ -69,14 +72,23 @@ class _PostBodyState extends State<PostBody> { | ||||||
|       child: Column( |       child: Column( | ||||||
|         crossAxisAlignment: CrossAxisAlignment.start, |         crossAxisAlignment: CrossAxisAlignment.start, | ||||||
|         children: [ |         children: [ | ||||||
|           TextButton.icon( |           Text( | ||||||
|  |               "sdkfjksdjfkd sldkjfksdjf dskfjsdkfjkds skdfjksdjfisdujfiosdhfjkldsfh sldkfjksdjfksdjfklsdjf"), | ||||||
|  |           OutlinedButton.icon( | ||||||
|               onPressed: () { |               onPressed: () { | ||||||
|                 setState(() { |                 setState(() { | ||||||
|                   visible = !visible; |                   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), |               icon: cwButtonIcon, | ||||||
|               label: const Text("warning")), |               label: Text(cwButtonText)), | ||||||
|           Visibility( |           Visibility( | ||||||
|             visible: visible, |             visible: visible, | ||||||
|             child: RichText( |             child: RichText( | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue