mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 19:17:58 +00:00
refactor ThemeData
This commit is contained in:
@@ -115,7 +115,8 @@ class _AddressBookState extends State<AddressBook> {
|
||||
Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: const BorderSide(color: MyTheme.grayBg)),
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).scaffoldBackgroundColor)),
|
||||
child: Container(
|
||||
width: 200,
|
||||
height: double.infinity,
|
||||
@@ -215,7 +216,8 @@ class _AddressBookState extends State<AddressBook> {
|
||||
child: Text(
|
||||
tagName,
|
||||
style: TextStyle(
|
||||
color: rxTags.contains(tagName) ? MyTheme.white : null),
|
||||
color:
|
||||
rxTags.contains(tagName) ? Colors.white : null), // TODO
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -26,7 +26,7 @@ class DraggableChatWindow extends StatelessWidget {
|
||||
position: position,
|
||||
width: width,
|
||||
height: height,
|
||||
builder: (_, onPanUpdate) {
|
||||
builder: (context, onPanUpdate) {
|
||||
return isIOS
|
||||
? ChatPage(chatModel: chatModel)
|
||||
: Scaffold(
|
||||
@@ -35,16 +35,16 @@ class DraggableChatWindow extends StatelessWidget {
|
||||
onPanUpdate: onPanUpdate,
|
||||
appBar: isDesktop
|
||||
? _buildDesktopAppBar()
|
||||
: _buildMobileAppBar(),
|
||||
: _buildMobileAppBar(context),
|
||||
),
|
||||
body: ChatPage(chatModel: chatModel),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildMobileAppBar() {
|
||||
Widget _buildMobileAppBar(BuildContext context) {
|
||||
return Container(
|
||||
color: MyTheme.accent50,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
height: 50,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -169,17 +169,17 @@ class DraggableMobileActions extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
color: MyTheme.white,
|
||||
color: Colors.white,
|
||||
onPressed: onBackPressed,
|
||||
splashRadius: 20,
|
||||
icon: const Icon(Icons.arrow_back)),
|
||||
IconButton(
|
||||
color: MyTheme.white,
|
||||
color: Colors.white,
|
||||
onPressed: onHomePressed,
|
||||
splashRadius: 20,
|
||||
icon: const Icon(Icons.home)),
|
||||
IconButton(
|
||||
color: MyTheme.white,
|
||||
color: Colors.white,
|
||||
onPressed: onRecentPressed,
|
||||
splashRadius: 20,
|
||||
icon: const Icon(Icons.more_horiz)),
|
||||
@@ -190,7 +190,7 @@ class DraggableMobileActions extends StatelessWidget {
|
||||
endIndent: 10,
|
||||
),
|
||||
IconButton(
|
||||
color: MyTheme.white,
|
||||
color: Colors.white,
|
||||
onPressed: onHidePressed,
|
||||
splashRadius: 20,
|
||||
icon: const Icon(Icons.keyboard_arrow_down)),
|
||||
|
||||
@@ -108,7 +108,9 @@ class _PeerCardState extends State<_PeerCard>
|
||||
return MouseRegion(
|
||||
onEnter: (evt) {
|
||||
deco.value = BoxDecoration(
|
||||
border: Border.all(color: MyTheme.button, width: _borderWidth),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
width: _borderWidth),
|
||||
borderRadius: peerCardUiType.value == PeerUiType.grid
|
||||
? BorderRadius.circular(_cardRadis)
|
||||
: null);
|
||||
@@ -130,8 +132,9 @@ class _PeerCardState extends State<_PeerCard>
|
||||
|
||||
Widget _buildPeerTile(
|
||||
BuildContext context, Peer peer, Rx<BoxDecoration?> deco) {
|
||||
final greyStyle =
|
||||
TextStyle(fontSize: 11, color: MyTheme.color(context).lighterText);
|
||||
final greyStyle = TextStyle(
|
||||
fontSize: 11,
|
||||
color: Theme.of(context).textTheme.titleLarge?.color?.withOpacity(0.6));
|
||||
final alias = bind.mainGetPeerOptionSync(id: peer.id, key: 'alias');
|
||||
return Obx(
|
||||
() => Container(
|
||||
@@ -148,7 +151,8 @@ class _PeerCardState extends State<_PeerCard>
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: MyTheme.color(context).bg),
|
||||
decoration:
|
||||
BoxDecoration(color: Theme.of(context).backgroundColor),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -250,7 +254,7 @@ class _PeerCardState extends State<_PeerCard>
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: MyTheme.color(context).bg,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -294,13 +298,21 @@ class _PeerCardState extends State<_PeerCard>
|
||||
child: CircleAvatar(
|
||||
radius: 14,
|
||||
backgroundColor: _iconMoreHover.value
|
||||
? MyTheme.color(context).grayBg!
|
||||
: MyTheme.color(context).bg!,
|
||||
? Theme.of(context).scaffoldBackgroundColor
|
||||
: Theme.of(context).backgroundColor,
|
||||
// ? Theme.of(context).scaffoldBackgroundColor!
|
||||
// : Theme.of(context).backgroundColor!,
|
||||
child: Icon(Icons.more_vert,
|
||||
size: 18,
|
||||
color: _iconMoreHover.value
|
||||
? MyTheme.color(context).text
|
||||
: MyTheme.color(context).lightText))));
|
||||
? Theme.of(context).textTheme.titleLarge?.color
|
||||
: Theme.of(context)
|
||||
.textTheme
|
||||
.titleLarge
|
||||
?.color
|
||||
?.withOpacity(0.5)))));
|
||||
// ? MyTheme.color(context).text
|
||||
// : MyTheme.color(context).lightText))));
|
||||
|
||||
/// Show the peer menu and handle user's choice.
|
||||
/// User might remove the peer or send a file to the peer.
|
||||
@@ -865,7 +877,7 @@ class AddressBookPeerCard extends BasePeerCard {
|
||||
child: Text(
|
||||
tagName,
|
||||
style: TextStyle(
|
||||
color: rxTags.contains(tagName) ? MyTheme.white : null),
|
||||
color: rxTags.contains(tagName) ? Colors.white : null),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -101,6 +101,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
}
|
||||
|
||||
Widget _createTabBar(BuildContext context) {
|
||||
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
||||
return ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
@@ -111,7 +112,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: _tabIndex.value == t.key
|
||||
? MyTheme.color(context).bg
|
||||
? Theme.of(context).backgroundColor
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(isDesktop ? 2 : 6),
|
||||
),
|
||||
@@ -123,9 +124,9 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 14,
|
||||
color: _tabIndex.value == t.key
|
||||
? MyTheme.color(context).text
|
||||
: MyTheme.color(context).lightText),
|
||||
color:
|
||||
_tabIndex.value == t.key ? textColor : textColor
|
||||
?..withOpacity(0.5)),
|
||||
),
|
||||
)),
|
||||
onTap: () async => await _handleTabSelection(t.key),
|
||||
@@ -147,7 +148,8 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
}
|
||||
|
||||
Widget _createPeerViewTypeSwitch(BuildContext context) {
|
||||
final activeDeco = BoxDecoration(color: MyTheme.color(context).bg);
|
||||
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
||||
final activeDeco = BoxDecoration(color: Theme.of(context).backgroundColor);
|
||||
return Row(
|
||||
children: [PeerUiType.grid, PeerUiType.list]
|
||||
.map((type) => Obx(
|
||||
@@ -166,9 +168,9 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
? Icons.grid_view_rounded
|
||||
: Icons.list,
|
||||
size: 18,
|
||||
color: peerCardUiType.value == type
|
||||
? MyTheme.color(context).text
|
||||
: MyTheme.color(context).lightText,
|
||||
color:
|
||||
peerCardUiType.value == type ? textColor : textColor
|
||||
?..withOpacity(0.5),
|
||||
)),
|
||||
),
|
||||
))
|
||||
@@ -212,7 +214,7 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
|
||||
return Container(
|
||||
width: 120,
|
||||
decoration: BoxDecoration(
|
||||
color: MyTheme.color(context).bg,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Obx(() => Row(
|
||||
@@ -222,7 +224,7 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
|
||||
children: [
|
||||
Icon(
|
||||
Icons.search_rounded,
|
||||
color: MyTheme.color(context).placeholder,
|
||||
color: Theme.of(context).hintColor,
|
||||
).marginSymmetric(horizontal: 4),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
@@ -234,7 +236,11 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
|
||||
focusNode: focusNode,
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
cursorColor: MyTheme.color(context).lightText,
|
||||
cursorColor: Theme.of(context)
|
||||
.textTheme
|
||||
.titleLarge
|
||||
?.color
|
||||
?.withOpacity(0.5),
|
||||
cursorHeight: 18,
|
||||
cursorWidth: 1,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
@@ -244,8 +250,7 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
|
||||
hintText:
|
||||
focused.value ? null : translate("Search ID"),
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: MyTheme.color(context).placeholder),
|
||||
fontSize: 14, color: Theme.of(context).hintColor),
|
||||
border: InputBorder.none,
|
||||
isDense: true,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user