mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: server card loading UI
This commit is contained in:
@@ -11,19 +11,7 @@ extension on _ServerPageState {
|
|||||||
builder: (_, cons) {
|
builder: (_, cons) {
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: cons.maxWidth / 2.3),
|
constraints: BoxConstraints(maxWidth: cons.maxWidth / 2.3),
|
||||||
child: Hero(
|
child: Text(s.spi.name, style: UIs.text13Bold, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||||
tag: 'home_card_title_${s.spi.id}',
|
|
||||||
transitionOnUserGestures: true,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: Text(
|
|
||||||
s.spi.name,
|
|
||||||
style: UIs.text13Bold.copyWith(color: context.isDark ? Colors.white : Colors.black),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -38,17 +26,9 @@ extension on _ServerPageState {
|
|||||||
|
|
||||||
Widget _buildTopRightWidget(Server s) {
|
Widget _buildTopRightWidget(Server s) {
|
||||||
final (child, onTap) = switch (s.conn) {
|
final (child, onTap) = switch (s.conn) {
|
||||||
ServerConn.connecting || ServerConn.loading || ServerConn.connected => (
|
ServerConn.connecting ||
|
||||||
SizedBox(
|
ServerConn.loading ||
|
||||||
width: 19,
|
ServerConn.connected => (SizedLoading(23, strokeWidth: 3, padding: 5), null),
|
||||||
height: 19,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 3,
|
|
||||||
valueColor: AlwaysStoppedAnimation(UIs.primaryColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
null,
|
|
||||||
),
|
|
||||||
ServerConn.failed => (
|
ServerConn.failed => (
|
||||||
const Icon(Icons.refresh, size: 21, color: Colors.grey),
|
const Icon(Icons.refresh, size: 21, color: Colors.grey),
|
||||||
() {
|
() {
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ class _ServerPageState extends State<ServerPage> with AutomaticKeepAliveClientMi
|
|||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_updateOffset();
|
_updateOffset();
|
||||||
_updateTextScaler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -100,14 +99,11 @@ class _ServerPageState extends State<ServerPage> with AutomaticKeepAliveClientMi
|
|||||||
appBar: _TopBar(tags: ServerProvider.tags, onTagChanged: (p0) => _tag.value = p0, initTag: _tag.value),
|
appBar: _TopBar(tags: ServerProvider.tags, onTagChanged: (p0) => _tag.value = p0, initTag: _tag.value),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: () => _autoHideCtrl.show(),
|
onTap: _autoHideCtrl.show,
|
||||||
child: ListenableBuilder(
|
child: Stores.setting.textFactor.listenable().listenVal((val) {
|
||||||
listenable: Stores.setting.textFactor.listenable(),
|
_updateTextScaler(val);
|
||||||
builder: (_, __) {
|
return child;
|
||||||
_updateTextScaler();
|
}),
|
||||||
return child;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
floatingActionButton: AutoHide(
|
floatingActionButton: AutoHide(
|
||||||
direction: AxisDirection.right,
|
direction: AxisDirection.right,
|
||||||
|
|||||||
@@ -170,8 +170,8 @@ extension _Utils on _ServerPageState {
|
|||||||
_offset = x * r * n;
|
_offset = x * r * n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateTextScaler() {
|
void _updateTextScaler(double val) {
|
||||||
_textFactorDouble = Stores.setting.textFactor.fetch();
|
_textFactorDouble = val;
|
||||||
_textFactor = TextScaler.linear(_textFactorDouble);
|
_textFactor = TextScaler.linear(_textFactorDouble);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user