Skip to content

Commit

Permalink
building apps, updating icons
Browse files Browse the repository at this point in the history
  • Loading branch information
yukiterunamaana committed Jun 12, 2024
1 parent 0539c8e commit 7c749f1
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 35 deletions.
1 change: 1 addition & 0 deletions lib/core/globals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Color? activatedReactionColor = Colors.red;
Color bgColor = Colors.amber;

bool animationsEnabled = false;
bool roundAvatar = false;

int postsPerRequest = 20; //max 40, default 20
const String myAccount = '112282440600157454';
Expand Down
8 changes: 0 additions & 8 deletions lib/core/main.dart

This file was deleted.

16 changes: 9 additions & 7 deletions lib/core/myapp.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:aadj/widgets/bottom_navigation_bar.dart';
import 'package:aadj/widgets/post_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart';

Expand All @@ -17,13 +18,14 @@ class MyApp extends StatelessWidget {

//fetchNotifications();
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
//colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: //AccountWidget(accountId: myAccount,)
const AppBottomBar());
title: 'Flutter Demo',
theme: ThemeData(
//colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: //AccountWidget(accountId: myAccount,)
const AppBottomBar(), //StatusWidget(statusId: '112525480179409844') //AppBottomBar()
);

//const NotificationWidget(notificationId: '275311914'));
}
Expand Down
15 changes: 15 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:aadj/auth/auth_page.dart';
import 'package:aadj/core/globals.dart';
import 'package:aadj/core/myapp.dart';
import 'package:aadj/widgets/account_view.dart';
import 'package:flutter/material.dart';

import 'widgets/bottom_navigation_bar.dart';

// //todo ASK ABOUT NOTIFICATIONS PROBLEM

void main() {
runApp(const MaterialApp(
home:
MyApp())); //AuthPage AppBottomBar MyApp AccountPropertiesWidget(accountId: myAccount)
}
75 changes: 61 additions & 14 deletions lib/widgets/account_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:mastodon_api/mastodon_api.dart';
Expand Down Expand Up @@ -41,18 +42,50 @@ class _AccountPropertiesWidgetState extends State<AccountPropertiesWidget> {
builder: (context, snapshot) {
if (snapshot.hasData) {
Account account = snapshot.data!;
return Card(
return SingleChildScrollView(
child: Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
animationsEnabled
? Image.network(account.header)
: Image.network(account.headerStatic),
animationsEnabled
? Image.network(account.avatar)
: Image.network(account.avatarStatic),
SizedBox(
width: MediaQuery.of(context).size.width,
height: 300, //100,
child: animationsEnabled
? Image.network(
account.header,
)
: Image.network(
account.headerStatic,
),
),

roundAvatar
? ClipOval(
child: animationsEnabled
? Image.network(
account.avatar,
width: 128,
height: 128,
)
: Image.network(
account.avatarStatic,
width: 128,
height: 128,
),
)
: animationsEnabled
? Image.network(
account.avatar,
width: 128,
height: 128,
)
: Image.network(
account.avatarStatic,
width: 128,
height: 128,
),
Text(
account.username,
style: tagStyle,
Expand All @@ -61,20 +94,26 @@ class _AccountPropertiesWidgetState extends State<AccountPropertiesWidget> {
account.displayName,
style: tagStyle,
),

account.acct != account.username
? Text(
account.acct,
style: tagStyle,
)
: Text(''),
: Container(),
Text(
account.note,
style: tagStyle,
),
Text('${account.followersCount} followers'),
Text('${account.followingCount} followings'),
Text('${account.statusesCount} statuses'),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('${account.followersCount} followers, '),
Text('${account.followingCount} followings, '),
Text('${account.statusesCount} statuses'),
],
),

Column(
children: account.fields.map((entry) {
return Container(
Expand Down Expand Up @@ -104,7 +143,15 @@ class _AccountPropertiesWidgetState extends State<AccountPropertiesWidget> {
),

Text(
'Created at: ${account.createdAt.month}/${account.createdAt.day}/${account.createdAt.year}')
'Created at: ${account.createdAt.month}/${account.createdAt.day}/${account.createdAt.year}'),

account.isLocked ?? false ? Icon(Icons.lock) : Container(),
account.isBot ?? false
? Icon(Icons.settings_suggest)
: Container(),
// account.isLocked!=null
// ? account!.isLocked?const Icon(Icons.settings_suggest):Null
// : Null,

//@JsonKey(name: 'locked') bool? isLocked,
//@JsonKey(name: 'bot') bool? isBot,
Expand All @@ -114,7 +161,7 @@ class _AccountPropertiesWidgetState extends State<AccountPropertiesWidget> {
],
),
),
);
));
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
Expand Down
110 changes: 110 additions & 0 deletions lib/widgets/buttons/menu_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,113 @@ report
if post.domain!=domain:
excommunicate domain
* */
// DropdownButtonHideUnderline(
//
// child: DropdownButton(
//
// value: _selectedOption,
//
// onChanged: (value) {
//
// setState(() {
//
// _selectedOption = value;
//
// });
//
// },
//
// items: [
//
// DropdownMenuItem(
//
// child: Text('Option 1'),
//
// value: 'option1',
//
// ),
//
// DropdownMenuItem(
//
// child: Text('Option 2'),
//
// value: 'option2',
//
// ),
//
// DropdownMenuItem(
//
// child: Text('Option 3'),
//
// value: 'option3',
//
// ),
//
// ],
//
// ),
//
// ),
import 'package:flutter/material.dart';
import 'package:mastodon_api/mastodon_api.dart';

import '../../core/globals.dart';

class MenuButton extends StatefulWidget {
final MastodonApi mastodon;
final String statusId;
final bool? isMuted;
final bool? isBlocked;

const MenuButton({
super.key,
required this.mastodon,
required this.statusId,
required this.isMuted,
required this.isBlocked,
});

@override
_MenuButtonState createState() => _MenuButtonState();
}

class _MenuButtonState extends State<MenuButton> {
// Create a variable to hold the current state of the menu
bool _isMenuVisible = false;

// Create a function to toggle the visibility of the menu
void _toggleMenu() {
setState(() {
_isMenuVisible = !_isMenuVisible;
});
}

@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
// Create the button that will summon the menu
IconButton(
onPressed: _toggleMenu,
icon: Icon(Icons.menu),
),

// Create the menu itself
if (_isMenuVisible)
Container(
width: double.infinity,
color: Colors.grey[200],
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
// Add menu items here
Text('Menu Item 1'),
Text('Menu Item 2'),
Text('Menu Item 3'),
],
),
),
],
);
}
}
7 changes: 7 additions & 0 deletions lib/widgets/post_bottom_bar.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:aadj/widgets/buttons/bookmark_button.dart';
import 'package:aadj/widgets/buttons/favorite_button.dart';
import 'package:aadj/core/globals.dart';
import 'package:aadj/widgets/buttons/menu_button.dart';
import 'package:aadj/widgets/buttons/reblog_button.dart';
import 'package:aadj/widgets/buttons/reply_button.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -40,6 +41,12 @@ class _PostBottomBarState extends State<PostBottomBar> {
mastodon: mstdn,
statusId: widget.statusId,
isBookmarked: widget.isBookmarked),
MenuButton(
mastodon: mstdn,
statusId: widget.statusId,
isMuted: null,
isBlocked: null,
),
//todo additional menu
//const Icon(Icons.menu_rounded),
],
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/post_creator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class _ComposeStatusWidgetState extends State<ComposeStatusWidget> {
// Show an error message
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Failed to publish status:')),
content: Text('Failed to publish status')),
);
}
print(response.rateLimit);
Expand All @@ -136,7 +136,7 @@ class _ComposeStatusWidgetState extends State<ComposeStatusWidget> {
// final status = mstdn.v1.statuses
// .createStatus(text: _statusController.text);
}),
Text('500' /*remainingCharacters.toString()*/),
//Text('500' /*remainingCharacters.toString()*/),
],
)
],
Expand Down
4 changes: 0 additions & 4 deletions lib/widgets/post_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ class _StatusWidgetState extends State<StatusWidget> {
),
),
const SizedBox(height: 8),
// Text(
// status.content,
// style: const TextStyle(fontSize: 16),
// ),
HtmlWidget(status.content),
//Expanded(
//child:
Expand Down
Binary file modified windows/runner/resources/app_icon.ico
Binary file not shown.

0 comments on commit 7c749f1

Please sign in to comment.