-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import '../common.dart'; | ||
|
||
const double borderRadius = 8; | ||
const double activeIconSize = 8; | ||
const double iconSize = 24; | ||
const double badgeSize = 36; | ||
const double messageBarHeight = 59; | ||
const double scrollBarRadius = 50; | ||
|
||
bool isLTR(BuildContext context) => | ||
!forceRTL && Directionality.of(context) == TextDirection.ltr; | ||
|
||
Widget mirrorLTR({required BuildContext context, required Widget child}) => | ||
Transform( | ||
alignment: Alignment.center, | ||
transform: Matrix4.rotationY(isLTR(context) ? 0 : pi), | ||
child: child, | ||
); | ||
|
||
bool shouldScroll({ | ||
required BuildContext context, | ||
required int numElements, | ||
required double elHeight, | ||
}) { | ||
var height = MediaQuery.of(context).size.height; | ||
var padding = MediaQuery.of(context).padding; | ||
var safeHeight = height - padding.top - padding.bottom; | ||
var topBarHeight = elHeight; | ||
|
||
// TODO: needs to be tested | ||
return safeHeight - topBarHeight < numElements * elHeight; | ||
} | ||
|
||
double calculateStickerHeight(BuildContext context, int messageCount) { | ||
final conversationInnerHeight = MediaQuery.of(context).size.height - | ||
100.0 - | ||
100.0; // rough approximation for inner height - top bar height - message bar height | ||
final messageHeight = | ||
60.0; // rough approximation of how much space a message takes up, including paddings | ||
final minStickerHeight = 353.0; | ||
return max( | ||
minStickerHeight, | ||
conversationInnerHeight - ((messageCount - 1) * messageHeight), | ||
); | ||
} | ||
|
||
double appBarHeight = 56.0; | ||
|
||
double defaultWarningBarHeight = 30.0; | ||
|
||
BorderRadius defaultBorderRadius = BorderRadius.circular(6.0); |