-
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
1 parent
0925dd9
commit 794aa44
Showing
7 changed files
with
148 additions
and
2 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
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
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
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
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
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
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,76 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:cli_script/cli_script.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:flutter_redux/flutter_redux.dart'; | ||
import 'package:hosts_manage/i18n/i18n.dart'; | ||
import 'package:hosts_manage/store/store.dart'; | ||
import 'package:hosts_manage/views/socks5/bloc/socks5_bloc.dart'; | ||
import 'package:macos_ui/macos_ui.dart'; | ||
|
||
// 提示文本 | ||
class Socks5Tooltip extends StatefulWidget { | ||
const Socks5Tooltip({ | ||
Key key, | ||
}) : super(key: key); | ||
|
||
@override | ||
_Socks5TooltipState createState() => _Socks5TooltipState(); | ||
} | ||
|
||
class _Socks5TooltipState extends State<Socks5Tooltip> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
} | ||
|
||
I18N lang; | ||
bool isAuto = false; | ||
|
||
@override | ||
void dispose() { | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return StoreBuilder<ZState>( | ||
builder: (context, store) { | ||
lang = StoreProvider.of<ZState>(context).state.lang; | ||
return BlocBuilder<Socks5Bloc, Socks5State>( | ||
buildWhen: (previous, current) { | ||
return false; | ||
}, | ||
builder: (context, state) { | ||
return RichText( | ||
text: TextSpan(children: [ | ||
TextSpan( | ||
text: Platform.isMacOS ? lang.get('socks5.socks5_tooltip_macos') : lang.get('socks5.socks5_tooltip_windows'), | ||
style: MacosTheme.of(context).typography.headline, | ||
), | ||
WidgetSpan( | ||
child: InkWell( | ||
onTap: () { | ||
if (Platform.isMacOS) { | ||
run('open /System/Library/PreferencePanes/Network.prefPane'); | ||
} | ||
}, | ||
child: Text( | ||
Platform.isMacOS ? lang.get('socks5.open_preference') : '', | ||
style: MacosTheme.of(context) | ||
.typography | ||
.headline | ||
.copyWith(color: MacosTheme.of(context).primaryColor), | ||
), | ||
), | ||
), | ||
]), | ||
); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
} |