This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# macos | |
## debug | |
./flutter/tools/gn --unoptimized | |
ninja -C out/host_debug_unopt | |
## release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static int[] calculateAutoFitWidthHeight(Size parentSize, Size originSize) { | |
int width = parentSize.getWidth(); | |
int height = parentSize.getHeight(); | |
int originW = originSize.getWidth(); | |
int originH = originSize.getHeight(); | |
float v1 = height / ((float) originH); | |
float v2 = width / ((float) originW); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
class FocusGridView extends GridView { | |
FocusGridView.builder({ | |
Key key, | |
Axis scrollDirection = Axis.vertical, | |
bool reverse = false, | |
ScrollController controller, | |
bool primary, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 让 RecyclerView 可以左滑删除 | |
* @param onItemSwiped 响应左滑删除时的调用 | |
* @param onItemRevoked 响应撤回删除时的调用 | |
*/ | |
private fun <T : Any> RecyclerView.setSwipeAble( | |
onItemSwiped: (position: Int) -> T, | |
onItemRevoked: (position: Int, value: T) -> Unit, | |
onItemMoved: (from: Int, to: Int) -> Boolean | |
) = ItemTouchHelper(object : ItemTouchHelper.Callback() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoadMoreDelegate(private val onLoadMoreListener: OnLoadMoreListener) { | |
fun attach(recyclerView: RecyclerView) { | |
recyclerView.addOnScrollListener(LoadMoreListener(onLoadMoreListener)) | |
} | |
class LoadMoreListener( | |
private val onLoadMoreListener: OnLoadMoreListener) : RecyclerView.OnScrollListener() { |