Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Fmar committed Aug 24, 2023
1 parent d37884d commit 0d4bc68
Show file tree
Hide file tree
Showing 21 changed files with 178 additions and 144 deletions.
2 changes: 2 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

- badges when something new in home/notifications/DMS
- allow to login with npub
- add theme icon on drawer for quick switching of dark/light theme
- replace relays numbers with search, move numbers to drawer
- fix zaps amounts in notes
- when changing accounts it doesn't refresh new profile data on UI
- filter out new posts from replies
- include reposts in following
- integration with https://github.com/greenart7c3/Amber
Expand Down
Binary file added assets/imgs/banner.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
16 changes: 8 additions & 8 deletions lib/i18n/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,11 @@ class I18n {
);
}

/// `Input dirtyword.`
String get Input_dirtyword {
/// `Input word.`
String get Input_word {
return Intl.message(
'Input dirtyword.',
name: 'Input_dirtyword',
'Input word.',
name: 'Input_word',
desc: '',
args: [],
);
Expand Down Expand Up @@ -779,11 +779,11 @@ class I18n {
);
}

/// `Filter`
String get Filter {
/// `Filters`
String get Filters {
return Intl.message(
'Filter',
name: 'Filter',
'Security Filters',
name: 'Filters',
desc: '',
args: [],
);
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Empty_text_may_be_ban_by_relays": MessageLookupByLibrary.simpleMessage(
"Empty text may be ban by relays."),
"Face": MessageLookupByLibrary.simpleMessage("Face"),
"Filter": MessageLookupByLibrary.simpleMessage("Filters"),
"Filters": MessageLookupByLibrary.simpleMessage("Security Filters"),
"Find_clouded_relay_list_do_you_want_to_download":
MessageLookupByLibrary.simpleMessage(
"Find clouded relay list, do you want to download it?"),
Expand Down
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:yana/provider/custom_emoji_provider.dart';
import 'package:yana/provider/follow_new_event_provider.dart';
import 'package:yana/provider/mention_me_new_provider.dart';
import 'package:yana/router/relays/relay_info_router.dart';
import 'package:yana/router/search/search_router.dart';
import 'package:yana/router/user/followed_router.dart';
import 'package:yana/router/user/followed_tags_list_router.dart';
import 'package:yana/router/user/user_history_contact_list_router.dart';
Expand Down Expand Up @@ -259,6 +260,7 @@ class _MyApp extends State<MyApp> {
RouterPath.EVENT_DETAIL: (context) => EventDetailRouter(),
RouterPath.TAG_DETAIL: (context) => TagDetailRouter(),
RouterPath.NOTICES: (context) => NoticeRouter(),
RouterPath.SEARCH: (context) => SearchRouter(),
RouterPath.KEY_BACKUP: (context) => KeyBackupRouter(),
RouterPath.RELAYS: (context) => RelaysRouter(),
RouterPath.FILTER: (context) => FilterRouter(),
Expand Down
4 changes: 2 additions & 2 deletions lib/router/filter/filter_block_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import 'package:provider/provider.dart';
import '../../utils/base.dart';
import '../../i18n/i18n.dart';

class FilterBlockComponent extends StatefulWidget {
class BlockedProfilesComponent extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _FilterBlockComponent();
}
}

class _FilterBlockComponent extends State<FilterBlockComponent> {
class _FilterBlockComponent extends State<BlockedProfilesComponent> {
@override
Widget build(BuildContext context) {
var _filterProvider = Provider.of<FilterProvider>(context);
Expand Down
6 changes: 3 additions & 3 deletions lib/router/filter/filter_dirtyword_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import '../../utils/base.dart';
import '../../i18n/i18n.dart';
import '../../utils/string_util.dart';

class FilterDirtywordComponent extends StatefulWidget {
class BlockedWordsComponent extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _FilterDirtywordComponent();
}
}

class _FilterDirtywordComponent extends State<FilterDirtywordComponent> {
class _FilterDirtywordComponent extends State<BlockedWordsComponent> {
TextEditingController controller = TextEditingController();

@override
Expand Down Expand Up @@ -48,7 +48,7 @@ class _FilterDirtywordComponent extends State<FilterDirtywordComponent> {
controller: controller,
decoration: InputDecoration(
prefixIcon: Icon(Icons.abc),
hintText: s.Input_dirtyword,
hintText: s.Input_word,
suffixIcon: IconButton(
icon: Icon(Icons.add),
onPressed: addDirtyWord,
Expand Down
4 changes: 2 additions & 2 deletions lib/router/filter/filter_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class _FilterRouter extends State<FilterRouter>
body: TabBarView(
controller: tabController,
children: [
FilterBlockComponent(),
FilterDirtywordComponent(),
BlockedWordsComponent(),
BlockedProfilesComponent(),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import '../../provider/setting_provider.dart';
import '../../utils/platform_util.dart';
import '../../utils/router_util.dart';

class MentionMeRouter extends StatefulWidget {
class NotificationsRouter extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _MentionMeRouter();
return _NotificationsRouter();
}
}

class _MentionMeRouter extends KeepAliveCustState<MentionMeRouter>
class _NotificationsRouter extends KeepAliveCustState<NotificationsRouter>
with LoadMoreEvent {
ScrollController _controller = ScrollController();

Expand Down
22 changes: 6 additions & 16 deletions lib/router/index/index_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@ class _IndexAppBar extends State<IndexAppBar> {
var center = widget.center;
center ??= Container();

var rightWidget =
Selector<RelayProvider, String>(builder: (context, relayNum, child) {
return Text(
relayNum,
style: TextStyle(color: textColor),
);
}, selector: (context, _provider) {
return _provider.relayNumStr();
});

return Container(
padding: EdgeInsets.only(
top: paddingTop,
Expand All @@ -83,12 +73,12 @@ class _IndexAppBar extends State<IndexAppBar> {
child: center,
),
),
GestureDetector(
onTap: () {
RouterUtil.router(context, RouterPath.RELAYS);
},
child: rightWidget,
),
// GestureDetector(
// onTap: () {
// RouterUtil.router(context, RouterPath.SEARCH);
// },
// child: Icon(Icons.search),
// ),
]),
);
}
Expand Down
93 changes: 55 additions & 38 deletions lib/router/index/index_drawer_content.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:yana/provider/index_provider.dart';
import 'package:yana/ui/user/metadata_top_component.dart';
import 'package:yana/utils/base.dart';
import 'package:yana/utils/router_path.dart';
import 'package:yana/provider/index_provider.dart';
import 'package:yana/router/user/user_statistics_component.dart';
import 'package:yana/utils/platform_util.dart';
import 'package:yana/utils/router_path.dart';
import 'package:yana/utils/router_util.dart';
import 'package:provider/provider.dart';

import '../../utils/index_taps.dart';
import '../../models/metadata.dart';
import '../../i18n/i18n.dart';
import '../../main.dart';
import '../../models/metadata.dart';
import '../../provider/metadata_provider.dart';
import '../../provider/relay_provider.dart';
import '../../utils/index_taps.dart';
import '../edit/editor_router.dart';
import 'account_manager_component.dart';

Expand All @@ -25,7 +25,7 @@ class IndexDrawerContnetComponnent extends StatefulWidget {

class _IndexDrawerContnetComponnent
extends State<IndexDrawerContnetComponnent> {
ScrollController userStatisticscontroller = ScrollController();
// ScrollController userStatisticscontroller = ScrollController();

double profileEditBtnWidth = 40;

Expand All @@ -35,7 +35,6 @@ class _IndexDrawerContnetComponnent

var s = I18n.of(context);
var pubkey = nostr!.publicKey;
var paddingTop = mediaDataCache.padding.top;
var themeData = Theme.of(context);
var mainColor = themeData.primaryColor;
var hintColor = themeData.hintColor;
Expand Down Expand Up @@ -64,16 +63,15 @@ class _IndexDrawerContnetComponnent
margin: const EdgeInsets.only(top: Base.BASE_PADDING_HALF),
padding: const EdgeInsets.only(
left: Base.BASE_PADDING * 2,
bottom: Base.BASE_PADDING/2,
top: Base.BASE_PADDING/2,
bottom: Base.BASE_PADDING / 2,
top: Base.BASE_PADDING / 2,
),

decoration: BoxDecoration(
border: Border(
top: BorderSide(
width: 1,
color: hintColor,
)))));
border: Border(
top: BorderSide(
width: 1,
color: hintColor,
)))));
// list.add(GestureDetector(
// behavior: HitTestBehavior.translucent,
// onHorizontalDragUpdate: (detail) {
Expand Down Expand Up @@ -102,7 +100,9 @@ class _IndexDrawerContnetComponnent
list.add(IndexDrawerItem(
iconData: Icons.notifications,
name: s.Globals,
color: _indexProvider.currentTap == IndexTaps.NOTIFICATIONS ? mainColor : null,
color: _indexProvider.currentTap == IndexTaps.NOTIFICATIONS
? mainColor
: null,
onTap: () {
indexProvider.setCurrentTap(1);
},
Expand Down Expand Up @@ -133,7 +133,7 @@ class _IndexDrawerContnetComponnent
iconData: Icons.person,
name: s.Profile,
onTap: () {
RouterUtil.router(context, RouterPath.KEY_BACKUP);
RouterUtil.router(context, RouterPath.USER, pubkey);
},
));

Expand All @@ -145,23 +145,33 @@ class _IndexDrawerContnetComponnent
},
));

list.add(IndexDrawerItem(
iconData: Icons.cloud,
name: s.Relays,
onTap: () {
RouterUtil.router(context, RouterPath.RELAYS);
},
));
list.add(
IndexDrawerItem(
iconData: Icons.lan_outlined,
name: s.Relays,
onTap: () {
RouterUtil.router(context, RouterPath.RELAYS);
},
rightWidget: Selector<RelayProvider, String>(
builder: (context, relayNum, child) {
return Text(
relayNum,
style: TextStyle(color: themeData.disabledColor),
);
}, selector: (context, _provider) {
return _provider.relayNumStr();
})
),
);

list.add(IndexDrawerItem(
iconData: Icons.filter_alt,
name: s.Filter,
iconData: Icons.security,
name: s.Filters,
onTap: () {
RouterUtil.router(context, RouterPath.FILTER);
},
));


list.add(IndexDrawerItem(
iconData: Icons.settings,
name: s.Setting,
Expand Down Expand Up @@ -194,8 +204,8 @@ class _IndexDrawerContnetComponnent
margin: const EdgeInsets.only(top: Base.BASE_PADDING_HALF),
padding: const EdgeInsets.only(
left: Base.BASE_PADDING * 2,
bottom: Base.BASE_PADDING/2,
top: Base.BASE_PADDING/2,
bottom: Base.BASE_PADDING / 2,
top: Base.BASE_PADDING / 2,
),
decoration: BoxDecoration(
border: Border(
Expand Down Expand Up @@ -236,6 +246,8 @@ class IndexDrawerItem extends StatelessWidget {

Color? color;

Widget? rightWidget;

// bool borderTop;

// bool borderBottom;
Expand All @@ -246,6 +258,7 @@ class IndexDrawerItem extends StatelessWidget {
required this.onTap,
this.color,
this.onDoubleTap,
this.rightWidget
// this.borderTop = true,
// this.borderBottom = false,
});
Expand All @@ -267,10 +280,20 @@ class IndexDrawerItem extends StatelessWidget {
),
));

list.add(Text(name, style: TextStyle(color: color)));
list.add(Text(name,
style: TextStyle(color: color, fontSize: Base.BASE_FONT_SIZE + 4)));

var borderSide = BorderSide(width: 1, color: hintColor);

if (rightWidget!=null) {
list.add(Container(
margin: EdgeInsets.only(
left: Base.BASE_PADDING,
),
child: rightWidget!)
);
}

return GestureDetector(
onTap: () {
onTap();
Expand All @@ -282,13 +305,7 @@ class IndexDrawerItem extends StatelessWidget {
},
behavior: HitTestBehavior.translucent,
child: Container(
height: 34,
// decoration: BoxDecoration(
// border: Border(
// top: borderTop ? borderSide : BorderSide.none,
// bottom: borderBottom ? borderSide : BorderSide.none,
// ),
// ),
height: 50,
child: Row(
children: list,
),
Expand Down
4 changes: 2 additions & 2 deletions lib/router/index/index_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:yana/ui/pc_router_fake.dart';
import 'package:yana/utils/base_consts.dart';
import 'package:yana/utils/index_taps.dart';
import 'package:yana/provider/pc_router_fake_provider.dart';
import 'package:yana/router/follow/mention_me_router.dart';
import 'package:yana/router/follow/notifications_router.dart';
import 'package:yana/utils/platform_util.dart';
import 'package:yana/utils/string_util.dart';

Expand Down Expand Up @@ -215,7 +215,7 @@ class _IndexRouter extends CustState<IndexRouter>
DMRouter(
tabController: dmTabController,
),
MentionMeRouter(),
NotificationsRouter(),
// NoticeRouter(),
],
)),
Expand Down
2 changes: 1 addition & 1 deletion lib/router/relays/relays_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _RelaysRouter extends CustState<RelaysRouter> with WhenStopFunction {
child: TextField(
controller: controller,
decoration: InputDecoration(
prefixIcon: Icon(Icons.cloud),
prefixIcon: Icon(Icons.lan),
hintText: s.Input_relay_address,
suffixIcon: IconButton(
icon: Icon(Icons.add),
Expand Down
Loading

0 comments on commit 0d4bc68

Please sign in to comment.