Merge pull request #3351 from NicKoehler/file-manager-redesign

Back icon fix and backgroundColor flutter migration
This commit is contained in:
RustDesk 2023-02-24 16:14:41 +08:00 committed by GitHub
commit af2ef7ac5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 48 additions and 39 deletions

View File

@ -45,6 +45,7 @@ var isWeb = false;
var isWebDesktop = false; var isWebDesktop = false;
var version = ""; var version = "";
int androidVersion = 0; int androidVersion = 0;
/// Incriment count for textureId. /// Incriment count for textureId.
int _textureId = 0; int _textureId = 0;
int get newTextureId => _textureId++; int get newTextureId => _textureId++;
@ -165,7 +166,6 @@ class MyTheme {
static ThemeData lightTheme = ThemeData( static ThemeData lightTheme = ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
backgroundColor: Color(0xFFEEEEEE),
hoverColor: Color.fromARGB(255, 224, 224, 224), hoverColor: Color.fromARGB(255, 224, 224, 224),
scaffoldBackgroundColor: Color(0xFFFFFFFF), scaffoldBackgroundColor: Color(0xFFFFFFFF),
textTheme: const TextTheme( textTheme: const TextTheme(
@ -177,7 +177,6 @@ class MyTheme {
labelLarge: TextStyle(fontSize: 16.0, color: MyTheme.accent80)), labelLarge: TextStyle(fontSize: 16.0, color: MyTheme.accent80)),
cardColor: Color(0xFFEEEEEE), cardColor: Color(0xFFEEEEEE),
hintColor: Color(0xFFAAAAAA), hintColor: Color(0xFFAAAAAA),
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity, visualDensity: VisualDensity.adaptivePlatformDensity,
tabBarTheme: const TabBarTheme( tabBarTheme: const TabBarTheme(
labelColor: Colors.black87, labelColor: Colors.black87,
@ -190,6 +189,10 @@ class MyTheme {
style: ButtonStyle(splashFactory: NoSplash.splashFactory), style: ButtonStyle(splashFactory: NoSplash.splashFactory),
) )
: null, : null,
colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue).copyWith(
brightness: Brightness.light,
background: Color(0xFFEEEEEE),
),
).copyWith( ).copyWith(
extensions: <ThemeExtension<dynamic>>[ extensions: <ThemeExtension<dynamic>>[
ColorThemeExtension.light, ColorThemeExtension.light,
@ -198,7 +201,6 @@ class MyTheme {
); );
static ThemeData darkTheme = ThemeData( static ThemeData darkTheme = ThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
backgroundColor: Color(0xFF24252B),
hoverColor: Color.fromARGB(255, 45, 46, 53), hoverColor: Color.fromARGB(255, 45, 46, 53),
scaffoldBackgroundColor: Color(0xFF18191E), scaffoldBackgroundColor: Color(0xFF18191E),
textTheme: const TextTheme( textTheme: const TextTheme(
@ -209,7 +211,6 @@ class MyTheme {
labelLarge: TextStyle( labelLarge: TextStyle(
fontSize: 16.0, fontWeight: FontWeight.bold, color: accent80)), fontSize: 16.0, fontWeight: FontWeight.bold, color: accent80)),
cardColor: Color(0xFF24252B), cardColor: Color(0xFF24252B),
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity, visualDensity: VisualDensity.adaptivePlatformDensity,
tabBarTheme: const TabBarTheme( tabBarTheme: const TabBarTheme(
labelColor: Colors.white70, labelColor: Colors.white70,
@ -227,6 +228,10 @@ class MyTheme {
: null, : null,
checkboxTheme: checkboxTheme:
const CheckboxThemeData(checkColor: MaterialStatePropertyAll(dark)), const CheckboxThemeData(checkColor: MaterialStatePropertyAll(dark)),
colorScheme: ColorScheme.fromSwatch(
brightness: Brightness.dark,
primarySwatch: Colors.blue,
).copyWith(background: Color(0xFF24252B)),
).copyWith( ).copyWith(
extensions: <ThemeExtension<dynamic>>[ extensions: <ThemeExtension<dynamic>>[
ColorThemeExtension.dark, ColorThemeExtension.dark,

View File

@ -75,7 +75,8 @@ class ChatPage extends StatelessWidget implements PageShape {
hintText: hintText:
"${translate('Write a message')}...", "${translate('Write a message')}...",
filled: true, filled: true,
fillColor: Theme.of(context).backgroundColor, fillColor:
Theme.of(context).colorScheme.background,
contentPadding: EdgeInsets.all(10), contentPadding: EdgeInsets.all(10),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
@ -88,7 +89,8 @@ class ChatPage extends StatelessWidget implements PageShape {
: defaultInputDecoration( : defaultInputDecoration(
hintText: hintText:
"${translate('Write a message')}...", "${translate('Write a message')}...",
fillColor: Theme.of(context).backgroundColor), fillColor:
Theme.of(context).colorScheme.background),
sendButtonBuilder: defaultSendButton( sendButtonBuilder: defaultSendButton(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 6, vertical: 0), horizontal: 6, vertical: 0),

View File

@ -170,8 +170,8 @@ class _PeerCardState extends State<_PeerCard>
), ),
Expanded( Expanded(
child: Container( child: Container(
decoration: decoration: BoxDecoration(
BoxDecoration(color: Theme.of(context).backgroundColor), color: Theme.of(context).colorScheme.background),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
@ -266,7 +266,7 @@ class _PeerCardState extends State<_PeerCard>
), ),
), ),
Container( Container(
color: Theme.of(context).backgroundColor, color: Theme.of(context).colorScheme.background,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -1173,7 +1173,7 @@ class ActionMore extends StatelessWidget {
radius: 14, radius: 14,
backgroundColor: _hover.value backgroundColor: _hover.value
? Theme.of(context).scaffoldBackgroundColor ? Theme.of(context).scaffoldBackgroundColor
: Theme.of(context).backgroundColor, : Theme.of(context).colorScheme.background,
child: Icon(Icons.more_vert, child: Icon(Icons.more_vert,
size: 18, size: 18,
color: _hover.value color: _hover.value

View File

@ -156,7 +156,7 @@ class _PeerTabPageState extends State<PeerTabPage>
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: model.currentTab == t color: model.currentTab == t
? Theme.of(context).backgroundColor ? Theme.of(context).colorScheme.background
: null, : null,
borderRadius: BorderRadius.circular(isDesktop ? 2 : 6), borderRadius: BorderRadius.circular(isDesktop ? 2 : 6),
), ),
@ -231,7 +231,8 @@ class _PeerTabPageState extends State<PeerTabPage>
Widget _createPeerViewTypeSwitch(BuildContext context) { Widget _createPeerViewTypeSwitch(BuildContext context) {
final textColor = Theme.of(context).textTheme.titleLarge?.color; final textColor = Theme.of(context).textTheme.titleLarge?.color;
final activeDeco = BoxDecoration(color: Theme.of(context).backgroundColor); final activeDeco =
BoxDecoration(color: Theme.of(context).colorScheme.background);
return Row( return Row(
children: [PeerUiType.grid, PeerUiType.list] children: [PeerUiType.grid, PeerUiType.list]
.map((type) => Obx( .map((type) => Obx(
@ -351,7 +352,7 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
return Container( return Container(
width: 120, width: 120,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).backgroundColor, color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: Obx(() => Row( child: Obx(() => Row(

View File

@ -164,7 +164,7 @@ class _ConnectionPageState extends State<ConnectionPage>
width: 320 + 20 * 2, width: 320 + 20 * 2,
padding: const EdgeInsets.fromLTRB(20, 24, 20, 22), padding: const EdgeInsets.fromLTRB(20, 24, 20, 22),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).backgroundColor, color: Theme.of(context).colorScheme.background,
borderRadius: const BorderRadius.all(Radius.circular(13)), borderRadius: const BorderRadius.all(Radius.circular(13)),
), ),
child: Ink( child: Ink(

View File

@ -71,7 +71,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
value: gFFI.serverModel, value: gFFI.serverModel,
child: Container( child: Container(
width: 200, width: 200,
color: Theme.of(context).backgroundColor, color: Theme.of(context).colorScheme.background,
child: DesktopScrollWrapper( child: DesktopScrollWrapper(
scrollController: _leftPaneScrollController, scrollController: _leftPaneScrollController,
child: SingleChildScrollView( child: SingleChildScrollView(
@ -185,7 +185,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
radius: 15, radius: 15,
backgroundColor: hover.value backgroundColor: hover.value
? Theme.of(context).scaffoldBackgroundColor ? Theme.of(context).scaffoldBackgroundColor
: Theme.of(context).backgroundColor, : Theme.of(context).colorScheme.background,
child: Icon( child: Icon(
Icons.more_vert_outlined, Icons.more_vert_outlined,
size: 20, size: 20,

View File

@ -108,7 +108,7 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).colorScheme.background,
body: Row( body: Row(
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(

View File

@ -65,7 +65,7 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final tabWidget = Container( final tabWidget = Container(
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).colorScheme.background,
body: DesktopTab( body: DesktopTab(
controller: tabController, controller: tabController,
tail: ActionIcon( tail: ActionIcon(

View File

@ -752,10 +752,13 @@ class _FileManagerPageState extends State<FileManagerPage>
padding: EdgeInsets.only( padding: EdgeInsets.only(
right: 3, right: 3,
), ),
child: RotatedBox(
quarterTurns: 2,
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/arrow.svg", "assets/arrow.svg",
color: Theme.of(context).tabBarTheme.labelColor, color: Theme.of(context).tabBarTheme.labelColor,
), ),
),
color: Theme.of(context).cardColor, color: Theme.of(context).cardColor,
hoverColor: Theme.of(context).hoverColor, hoverColor: Theme.of(context).hoverColor,
onPressed: () { onPressed: () {

View File

@ -91,7 +91,7 @@ class _PortForwardPageState extends State<PortForwardPage>
Flexible( Flexible(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).backgroundColor, color: Theme.of(context).colorScheme.background,
border: Border.all(width: 1, color: MyTheme.border)), border: Border.all(width: 1, color: MyTheme.border)),
child: child:
widget.isRDP ? buildRdp(context) : buildTunnel(context), widget.isRDP ? buildRdp(context) : buildTunnel(context),
@ -134,7 +134,7 @@ class _PortForwardPageState extends State<PortForwardPage>
return Theme( return Theme(
data: Theme.of(context) data: Theme.of(context)
.copyWith(backgroundColor: Theme.of(context).backgroundColor), .copyWith(backgroundColor: Theme.of(context).colorScheme.background),
child: Obx(() => ListView.builder( child: Obx(() => ListView.builder(
controller: ScrollController(), controller: ScrollController(),
itemCount: pfs.length + 2, itemCount: pfs.length + 2,
@ -169,7 +169,8 @@ class _PortForwardPageState extends State<PortForwardPage>
return Container( return Container(
height: _kRowHeight, height: _kRowHeight,
decoration: BoxDecoration(color: Theme.of(context).backgroundColor), decoration:
BoxDecoration(color: Theme.of(context).colorScheme.background),
child: Row(children: [ child: Row(children: [
buildTunnelInputCell(context, buildTunnelInputCell(context,
controller: localPortController, controller: localPortController,
@ -229,7 +230,7 @@ class _PortForwardPageState extends State<PortForwardPage>
borderSide: BorderSide(color: MyTheme.color(context).border!)), borderSide: BorderSide(color: MyTheme.color(context).border!)),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: MyTheme.color(context).border!)), borderSide: BorderSide(color: MyTheme.color(context).border!)),
fillColor: Theme.of(context).backgroundColor, fillColor: Theme.of(context).colorScheme.background,
contentPadding: const EdgeInsets.all(10), contentPadding: const EdgeInsets.all(10),
hintText: hint, hintText: hint,
hintStyle: hintStyle:
@ -251,7 +252,7 @@ class _PortForwardPageState extends State<PortForwardPage>
? MyTheme.currentThemeMode() == ThemeMode.dark ? MyTheme.currentThemeMode() == ThemeMode.dark
? const Color(0xFF202020) ? const Color(0xFF202020)
: const Color(0xFFF4F5F6) : const Color(0xFFF4F5F6)
: Theme.of(context).backgroundColor), : Theme.of(context).colorScheme.background),
child: Row(children: [ child: Row(children: [
text(pf.localPort.toString()), text(pf.localPort.toString()),
const SizedBox(width: _kColumn1Width), const SizedBox(width: _kColumn1Width),
@ -293,7 +294,7 @@ class _PortForwardPageState extends State<PortForwardPage>
).marginOnly(left: _kTextLeftMargin)); ).marginOnly(left: _kTextLeftMargin));
return Theme( return Theme(
data: Theme.of(context) data: Theme.of(context)
.copyWith(backgroundColor: Theme.of(context).backgroundColor), .copyWith(backgroundColor: Theme.of(context).colorScheme.background),
child: ListView.builder( child: ListView.builder(
controller: ScrollController(), controller: ScrollController(),
itemCount: 2, itemCount: 2,
@ -312,8 +313,8 @@ class _PortForwardPageState extends State<PortForwardPage>
} else { } else {
return Container( return Container(
height: _kRowHeight, height: _kRowHeight,
decoration: decoration: BoxDecoration(
BoxDecoration(color: Theme.of(context).backgroundColor), color: Theme.of(context).colorScheme.background),
child: Row(children: [ child: Row(children: [
Expanded( Expanded(
child: Align( child: Align(

View File

@ -96,7 +96,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)), border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).colorScheme.background,
body: DesktopTab( body: DesktopTab(
controller: tabController, controller: tabController,
onWindowCloseButton: () async { onWindowCloseButton: () async {

View File

@ -225,7 +225,7 @@ class _RemotePageState extends State<RemotePage>
Widget buildBody(BuildContext context) { Widget buildBody(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).colorScheme.background,
/// the Overlay key will be set with _blockableOverlayState in BlockableOverlay /// the Overlay key will be set with _blockableOverlayState in BlockableOverlay
/// see override build() in [BlockableOverlay] /// see override build() in [BlockableOverlay]

View File

@ -141,7 +141,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
width: stateGlobal.windowBorderWidth.value), width: stateGlobal.windowBorderWidth.value),
), ),
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).colorScheme.background,
body: DesktopTab( body: DesktopTab(
controller: tabController, controller: tabController,
onWindowCloseButton: handleWindowCloseButton, onWindowCloseButton: handleWindowCloseButton,

View File

@ -49,10 +49,7 @@ class _DesktopServerPageState extends State<DesktopServerPage>
@override @override
void onWindowClose() { void onWindowClose() {
Future.wait([ Future.wait([gFFI.serverModel.closeAll(), gFFI.close()]).then((_) {
gFFI.serverModel.closeAll(),
gFFI.close()
]).then((_) {
if (Platform.isMacOS) { if (Platform.isMacOS) {
RdPlatformChannel.instance.terminate(); RdPlatformChannel.instance.terminate();
} else { } else {
@ -82,7 +79,7 @@ class _DesktopServerPageState extends State<DesktopServerPage>
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)), border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).colorScheme.background,
body: Center( body: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -189,7 +186,7 @@ class ConnectionManagerState extends State<ConnectionManager> {
windowManager.startDragging(); windowManager.startDragging();
}, },
child: Container( child: Container(
color: Theme.of(context).backgroundColor, color: Theme.of(context).colorScheme.background,
), ),
), ),
), ),