Skip to content

Commit

Permalink
version: Update version
Browse files Browse the repository at this point in the history
  • Loading branch information
violet-dev committed Sep 24, 2021
1 parent 6293c24 commit 5dd05d9
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 44 deletions.
8 changes: 7 additions & 1 deletion OPTIMIZE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ https://blog.codemagic.io/how-to-improve-the-performance-of-your-flutter-app./

https://github.com/rrousselGit/functional_widget

https://medium.com/@remirousselet/flutter-reducing-widgets-boilerplate-3e635f10685e
https://medium.com/@remirousselet/flutter-reducing-widgets-boilerplate-3e635f10685e

https://stackoverflow.com/questions/44379366/why-does-setstate-take-a-closure

https://stackoverflow.com/questions/52249578/how-to-deal-with-unwanted-widget-build

https://developpaper.com/the-ultimate-solution-to-prevent-widget-rebuild-by-flutter/
10 changes: 9 additions & 1 deletion lib/pages/main/patchnote/patchnote_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ class PatchModel {
}

final patches = [
PatchModel(
dateTime: DateTime(2021, 9, 24),
version: '1.16.1 Patch Update <== Latest',
contents: [
'optimize critical ui processes-2',
'replace sync info url',
],
),
PatchModel(
dateTime: DateTime(2021, 9, 22),
version: '1.16 Patch Update <== Latest',
version: '1.16 Minor Update',
contents: [
'optimize critical ui processes',
'add hisoki.me router',
Expand Down
29 changes: 23 additions & 6 deletions lib/pages/search/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class _SearchPageState extends State<SearchPage>
queryResult = latestQuery.item1.item1;
if (_filterController.isPopulationSort)
Population.sortByPopulation(queryResult);
_shouldReload = true;
setState(() {});
} catch (e) {
print('Initial search failed: $e');
Expand Down Expand Up @@ -143,11 +144,24 @@ class _SearchPageState extends State<SearchPage>

ScrollController _scroll = ScrollController();

bool _shouldReload = false;
ResultPanelWidget _cachedPannel;

// https://stackoverflow.com/questions/60643355/is-it-possible-to-have-both-expand-and-contract-effects-with-the-slivers-in
@override
Widget build(BuildContext context) {
super.build(context);
final height = MediaQuery.of(context).size.height;

final panel = ResultPanelWidget(
dateTime: datetime,
resultList: filter(),
key: key,
);

if (_cachedPannel == null || _shouldReload) {
_shouldReload = false;
_cachedPannel = panel;
}

return SafeArea(
bottom: false,
Expand All @@ -169,11 +183,7 @@ class _SearchPageState extends State<SearchPage>
),
),
),
ResultPanelWidget(
dateTime: datetime,
resultList: filter(),
key: key,
),
_cachedPannel
],
),
);
Expand Down Expand Up @@ -248,6 +258,7 @@ class _SearchPageState extends State<SearchPage>
isFilterUsed = false;
await loadNextQuery();
setState(() {
_shouldReload = true;
key = ObjectKey(Uuid().v4());
});
},
Expand Down Expand Up @@ -341,6 +352,7 @@ class _SearchPageState extends State<SearchPage>
))
.then((value) async {
await Future.delayed(Duration(milliseconds: 50), () {
_shouldReload = true;
setState(() {});
});
});
Expand Down Expand Up @@ -370,6 +382,7 @@ class _SearchPageState extends State<SearchPage>
.then((value) async {
_applyFilter();
setState(() {
_shouldReload = true;
key = ObjectKey(Uuid().v4());
});
});
Expand All @@ -386,6 +399,7 @@ class _SearchPageState extends State<SearchPage>
.then((value) async {
_applyFilter();
setState(() {
_shouldReload = true;
key = ObjectKey(Uuid().v4());
});
});
Expand Down Expand Up @@ -492,6 +506,7 @@ class _SearchPageState extends State<SearchPage>
if (_filterController.isPopulationSort)
Population.sortByPopulation(queryResult);

_shouldReload = true;
setState(() {});
} catch (e, st) {
Logger.error('[search-error] E: ' + e.toString() + '\n' + st.toString());
Expand Down Expand Up @@ -553,6 +568,8 @@ class _SearchPageState extends State<SearchPage>
}
}

int count = 0;

class ResultPanelWidget extends StatelessWidget {
final List<QueryResult> resultList;
final DateTime dateTime;
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/settings/version_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class VersionViewPage extends StatelessWidget {
style: TextStyle(fontSize: 30),
),
Text(
'1.16.0',
'1.16.1',
style: TextStyle(fontSize: 20),
),
Text(''),
Expand Down
2 changes: 1 addition & 1 deletion lib/version/update_sync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UpdateSyncManager {
// Current version
static const int majorVersion = 1;
static const int minorVersion = 16;
static const int patchVersion = 0;
static const int patchVersion = 1;

static String get currentVersion =>
'$majorVersion.$minorVersion.$patchVersion';
Expand Down
55 changes: 22 additions & 33 deletions lib/widgets/article_item/article_list_item_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class _ArticleListItemVerySimpleWidgetState
double pad = 0.0;
double scale = 1.0;
bool onScaling = false;
// AnimationController scaleAnimationController;
bool isBlurred = false;
bool disposed = false;
ValueNotifier<bool> isBookmarked = ValueNotifier<bool>(false);
Expand Down Expand Up @@ -110,7 +109,6 @@ class _ArticleListItemVerySimpleWidgetState
void dispose() {
disposed = true;
super.dispose();
// scaleAnimationController.dispose();
}

bool firstChecked = false;
Expand All @@ -125,6 +123,7 @@ class _ArticleListItemVerySimpleWidgetState
data = Provider.of<ArticleListItem>(context);
else
data = widget.articleListItem;

disableFiltering = (data.disableFilter != null && data.disableFilter);

thisWidth = data.showDetail
Expand All @@ -136,28 +135,12 @@ class _ArticleListItemVerySimpleWidgetState
? 500.0
: data.width * 4 / 3;

// _initAnimations();
_checkIsBookmarked();
_checkLastRead();
_initTexts();
_setProvider();
}

// _initAnimations() {
// scaleAnimationController = AnimationController(
// vsync: this,
// lowerBound: 1.0,
// upperBound: 1.08,
// duration: Duration(milliseconds: 180),
// );
// scaleAnimationController.addListener(() {
// if (scaleAnimationController.value != scale)
// setState(() {
// scale = scaleAnimationController.value;
// });
// });
// }

_checkIsBookmarked() {
Bookmark.getInstance().then((value) async {
isBookmarked.value = await value.isBookmark(data.queryResult.id());
Expand All @@ -175,6 +158,7 @@ class _ArticleListItemVerySimpleWidgetState
.inDays <
31);
if (x.length == 0) return;
_shouldReload = true;
setState(() {
isLastestRead = true;
latestReadPage = x.first.lastPage();
Expand All @@ -198,46 +182,46 @@ class _ArticleListItemVerySimpleWidgetState
dateTime = data.queryResult.getDateTime() != null
? DateFormat('yyyy/MM/dd HH:mm').format(data.queryResult.getDateTime())
: '';
_shouldReload = true;
setState(() {});
}

_setProvider() {
if (!ProviderManager.isExists(data.queryResult.id())) {
// HitomiManager.getImageList(data.queryResult.id().toString())
// .then((images) {
// if (images == null) {
// return;
// }
// thumbnail = images.item2[0];
// imageCount = images.item2.length;
// ThumbnailManager.insert(data.queryResult.id(), images);
// if (!disposed) setState(() {});
// });

HentaiManager.getImageProvider(data.queryResult).then((value) async {
thumbnail = await value.getThumbnailUrl();
imageCount = value.length();
headers = await value.getHeader(0);
ProviderManager.insert(data.queryResult.id(), value);
if (!disposed) setState(() {});
if (!disposed)
setState(() {
_shouldReload = true;
});
});
} else {
Future.delayed(Duration(milliseconds: 1)).then((v) async {
var provider = ProviderManager.get(data.queryResult.id());
thumbnail = await provider.getThumbnailUrl();
imageCount = provider.length();
headers = await provider.getHeader(0);
if (!disposed) setState(() {});
if (!disposed)
setState(() {
_shouldReload = true;
});
});
}
}

BodyWidget _body;
bool _shouldReload = false;

@override
Widget build(BuildContext context) {
super.build(context);

if (disposed) return null;

// _init();
_init();

if (data.bookmarkMode &&
!widget.isCheckMode &&
Expand Down Expand Up @@ -275,6 +259,11 @@ class _ArticleListItemVerySimpleWidgetState
dateTime: dateTime,
);

if (_body == null || _shouldReload) {
_shouldReload = false;
_body = body;
}

return Container(
color: widget.isChecked ? Colors.amber : Colors.transparent,
child: PimpedButton(
Expand All @@ -291,7 +280,7 @@ class _ArticleListItemVerySimpleWidgetState
..translate(thisWidth / 2, thisHeight / 2)
..scale(scale)
..translate(-thisWidth / 2, -thisHeight / 2),
child: body,
child: _body,
),
),
onTapDown: _onTapDown,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: Open Source Hentai Viewer App
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.16.0+0
version: 1.16.1+0

publish_to: none

Expand Down

0 comments on commit 5dd05d9

Please sign in to comment.