Merge pull request #15 from boa-z/master

Enhancements for accounts_page and macOS build
This commit is contained in:
nyne
2024-11-03 10:02:23 +08:00
committed by GitHub
3 changed files with 89 additions and 85 deletions

View File

@@ -27,16 +27,16 @@ jobs:
- name: Build Flutter macOS App - name: Build Flutter macOS App
run: flutter build macos --release run: flutter build macos --release
# Step 3: Create the DMG file
# Step 4: Create the DMG file
- name: Create DMG - name: Create DMG
run: | run: |
mkdir -p dist mkdir -p dist
hdiutil create -volname "venera" -srcfolder build/macos/Build/Products/Release/venera.app -ov -format UDZO "dist/venera.dmg" mkdir -p dist/dmg_contents
cp -R build/macos/Build/Products/Release/venera.app dist/dmg_contents/
ln -s /Applications dist/dmg_contents/Applications
hdiutil create -volname "venera" -srcfolder dist/dmg_contents -ov -format UDZO "dist/venera.dmg"
# Step 4: Attach and upload artifacts (optional)
# Step 8: Attach and upload artifacts (optional)
- name: Upload DMG - name: Upload DMG
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:

View File

@@ -173,84 +173,88 @@ class _LoginPageState extends State<_LoginPage> {
child: Container( child: Container(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
constraints: const BoxConstraints(maxWidth: 400), constraints: const BoxConstraints(maxWidth: 400),
child: Column( child: AutofillGroup(
mainAxisSize: MainAxisSize.min, child: Column(
children: [ mainAxisSize: MainAxisSize.min,
Text("Login".tl, style: const TextStyle(fontSize: 24)), children: [
const SizedBox(height: 32), Text("Login".tl, style: const TextStyle(fontSize: 24)),
if (widget.config.cookieFields == null) const SizedBox(height: 32),
TextField( if (widget.config.cookieFields == null)
decoration: InputDecoration( TextField(
labelText: "Username".tl, decoration: InputDecoration(
border: const OutlineInputBorder(), labelText: "Username".tl,
), border: const OutlineInputBorder(),
enabled: widget.config.login != null, ),
onChanged: (s) { enabled: widget.config.login != null,
username = s; onChanged: (s) {
}, username = s;
).paddingBottom(16), },
if (widget.config.cookieFields == null) autofillHints: const [AutofillHints.username],
TextField( ).paddingBottom(16),
decoration: InputDecoration( if (widget.config.cookieFields == null)
labelText: "Password".tl, TextField(
border: const OutlineInputBorder(), decoration: InputDecoration(
), labelText: "Password".tl,
obscureText: true, border: const OutlineInputBorder(),
enabled: widget.config.login != null, ),
onChanged: (s) { obscureText: true,
password = s; enabled: widget.config.login != null,
}, onChanged: (s) {
onSubmitted: (s) => login(), password = s;
).paddingBottom(16), },
for (var field in widget.config.cookieFields ?? <String>[]) onSubmitted: (s) => login(),
TextField( autofillHints: const [AutofillHints.password],
decoration: InputDecoration( ).paddingBottom(16),
labelText: field, for (var field in widget.config.cookieFields ?? <String>[])
border: const OutlineInputBorder(), TextField(
), decoration: InputDecoration(
obscureText: true, labelText: field,
enabled: widget.config.validateCookies != null, border: const OutlineInputBorder(),
onChanged: (s) { ),
_cookies[field] = s; obscureText: true,
}, enabled: widget.config.validateCookies != null,
).paddingBottom(16), onChanged: (s) {
if (widget.config.login == null && _cookies[field] = s;
widget.config.cookieFields == null) },
Row( ).paddingBottom(16),
mainAxisSize: MainAxisSize.min, if (widget.config.login == null &&
children: [ widget.config.cookieFields == null)
const Icon(Icons.error_outline), Row(
const SizedBox(width: 8),
Text("Login with password is disabled".tl),
],
)
else
Button.filled(
isLoading: loading,
onPressed: login,
child: Text("Continue".tl),
),
const SizedBox(height: 24),
if (widget.config.loginWebsite != null)
TextButton(
onPressed: loginWithWebview,
child: Text("Login with webview".tl),
),
const SizedBox(height: 8),
if (widget.config.registerWebsite != null)
TextButton(
onPressed: () =>
launchUrlString(widget.config.registerWebsite!),
child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Icon(Icons.link), const Icon(Icons.error_outline),
const SizedBox(width: 8), const SizedBox(width: 8),
Text("Create Account".tl), Text("Login with password is disabled".tl),
], ],
)
else
Button.filled(
isLoading: loading,
onPressed: login,
child: Text("Continue".tl),
), ),
), const SizedBox(height: 24),
], if (widget.config.loginWebsite != null)
TextButton(
onPressed: loginWithWebview,
child: Text("Login with webview".tl),
),
const SizedBox(height: 8),
if (widget.config.registerWebsite != null)
TextButton(
onPressed: () =>
launchUrlString(widget.config.registerWebsite!),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.link),
const SizedBox(width: 8),
Text("Create Account".tl),
],
),
),
],
),
), ),
), ),
), ),

View File

@@ -98,14 +98,14 @@ class _AppWebviewState extends State<AppWebview> {
0), 0),
items: [ items: [
PopupMenuItem( PopupMenuItem(
child: Text("Open in browser".tl), child: Text("Open in browser".tl),
onTap: () async => onTap: () async =>
launchUrlString((await controller?.getUrl())!.path), launchUrlString((await controller?.getUrl())!.toString()),
), ),
PopupMenuItem( PopupMenuItem(
child: Text("Copy link".tl), child: Text("Copy link".tl),
onTap: () async => Clipboard.setData(ClipboardData( onTap: () async => Clipboard.setData(ClipboardData(
text: (await controller?.getUrl())!.path)), text: (await controller?.getUrl())!.toString())),
), ),
PopupMenuItem( PopupMenuItem(
child: Text("Reload".tl), child: Text("Reload".tl),