~cytrogen/fluent-reader-mobile

e46dd4a5a6f0336196561790f696ca0cac06b9fb — Bruce Liu 5 years ago fb752e1
add suggestions to editor
M lib/l10n/intl_en.arb => lib/l10n/intl_en.arb +2 -1
@@ 80,5 80,6 @@
    "confirm": "Confirm",
    "allLoaded": "All loaded",
    "removeAd": "Remove Ad",
    "getApiKey": "Get API ID & Key"
    "getApiKey": "Get API ID & Key",
    "getApiKeyHint": "In \"Preferences\" > \"Developer\""
  }
\ No newline at end of file

M lib/l10n/intl_zh.arb => lib/l10n/intl_zh.arb +2 -1
@@ 80,5 80,6 @@
    "confirm": "确定",
    "allLoaded": "已全部加载",
    "removeAd": "移除广告",
    "getApiKey": "获取 API ID & KEY"
    "getApiKey": "获取 API ID & KEY",
    "getApiKeyHint": "在 “偏好设置” > “开发者” 下"
  }
\ No newline at end of file

M lib/pages/item_list_page.dart => lib/pages/item_list_page.dart +1 -1
@@ 175,7 175,7 @@ class _ItemListPageState extends State<ItemListPage> {
        saveText: S.of(context).search,
        initialValue: getFeed().search,
        navigationBarColor: CupertinoColors.systemBackground,
        enableSuggestions: true,
        autocorrect: true,
      ),
    ));
    if (keyword == null) return;

M lib/pages/settings/services/feedbin_page.dart => lib/pages/settings/services/feedbin_page.dart +4 -0
@@ 33,6 33,10 @@ class _FeedbinPageState extends State<FeedbinPage> {
        Utils.testUrl,
        initialValue: _endpoint,
        inputType: TextInputType.url,
        suggestions: [
          "https://api.feedbin.com/v2/",
          "https://api.feedbin.me/v2/",
        ],
      ),
    ));
    if (endpoint == null) return;

M lib/pages/settings/services/greader_page.dart => lib/pages/settings/services/greader_page.dart +4 -0
@@ 34,6 34,10 @@ class _GReaderPageState extends State<GReaderPage> {
        Utils.testUrl,
        initialValue: _endpoint,
        inputType: TextInputType.url,
        suggestions: [
          "https://bazqux.com",
          "https://theoldreader.com",
        ],
      ),
    ));
    if (endpoint == null) return;

M lib/pages/settings/services/inoreader_page.dart => lib/pages/settings/services/inoreader_page.dart +12 -1
@@ 204,13 204,23 @@ class _InoreaderPageState extends State<InoreaderPage> {
          ? S.of(context).enter
          : S.of(context).entered),
        onTap: _editAPIKey,
        withDivider: false,
      ),
    ], title: S.of(context).credentials);
    final getKeyItems = ListTileGroup([
      MyListTile(
        title: Text(S.of(context).getApiKey),
        onTap: _getKey,
      ),
      MyListTile(
        title: Text(
          S.of(context).getApiKeyHint,
          style: TextStyle(color: CupertinoColors.secondaryLabel.resolveFrom(context)),
        ),
        trailingChevron: false,
        withDivider: false,
      ),
    ], title: S.of(context).credentials);
    ]);
    final syncItems = ListTileGroup([
      MyListTile(
        title: Text(S.of(context).removeAd),


@@ 292,6 302,7 @@ class _InoreaderPageState extends State<InoreaderPage> {
      child: ListView(children: [
        endpointItems,
        inputs,
        getKeyItems,
        syncItems,
        saveButton,
        if (Global.service != null) logOutButton,

M lib/pages/settings/text_editor_page.dart => lib/pages/settings/text_editor_page.dart +19 -4
@@ 1,6 1,7 @@
import 'dart:async';

import 'package:fluent_reader_lite/components/list_tile_group.dart';
import 'package:fluent_reader_lite/components/my_list_tile.dart';
import 'package:fluent_reader_lite/generated/l10n.dart';
import 'package:fluent_reader_lite/utils/colors.dart';
import 'package:flutter/cupertino.dart';


@@ 12,7 13,8 @@ class TextEditorPage extends StatefulWidget {
  final Color navigationBarColor;
  final FutureOr<bool> Function(String) validate;
  final TextInputType inputType;
  final bool enableSuggestions;
  final bool autocorrect;
  final List<String> suggestions;

  TextEditorPage(
    this.title,


@@ 22,7 24,8 @@ class TextEditorPage extends StatefulWidget {
      this.saveText,
      this.initialValue: "",
      this.inputType,
      this.enableSuggestions: false,
      this.autocorrect: false,
      this.suggestions,
      Key key,
    })
    : super(key: key);


@@ 93,10 96,22 @@ class _TextEditorPage extends State<TextEditorPage> {
            obscureText: widget.inputType == TextInputType.visiblePassword,
            keyboardType: widget.inputType,
            onSubmitted: (v) { _onSave(); },
            autocorrect: widget.enableSuggestions,
            enableSuggestions: widget.enableSuggestions,
            autocorrect: widget.autocorrect,
            enableSuggestions: widget.autocorrect,
          ),
        ]),
        if (widget.suggestions != null) ...widget.suggestions.map((s) {
          return MyListTile(
            title: Flexible(child: Text(
              s,
              style: TextStyle(color: CupertinoColors.secondaryLabel.resolveFrom(context)),
              overflow: TextOverflow.ellipsis,
            )),
            trailingChevron: false,
            background: MyColors.background,
            onTap: () { _controller.text = s; },
          );
        })
      ]),
    );
  }

M lib/pages/setup_page.dart => lib/pages/setup_page.dart +17 -0
@@ 5,6 5,7 @@ import 'package:fluent_reader_lite/utils/colors.dart';
import 'package:fluent_reader_lite/utils/global.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:package_info/package_info.dart';

class SetupPage extends StatelessWidget {
  void _configure(BuildContext context, String route) {


@@ 44,13 45,29 @@ class SetupPage extends StatelessWidget {
      MyListTile(
        title: Text("Feedbin"),
        onTap: () { _configure(context, "/settings/service/feedbin"); },
        withDivider: false,
      ),
    ], title: S.of(context).service);
    final settings = ListTileGroup([
      MyListTile(
        title: Text(S.of(context).general),
        onTap: () { _configure(context, "/settings/general"); },
      ),
      MyListTile(
        title: Text(S.of(context).about),
        onTap: () async {
          var infos = await PackageInfo.fromPlatform();
          Navigator.of(context).pushNamed("/settings/about", arguments: infos.version);
        },
        withDivider: false,
      ),
    ], title: S.of(context).settings);
    final page = CupertinoPageScaffold(
      backgroundColor: MyColors.background,
      child: ListView(children: [
        top,
        services,
        settings,
      ]),
    );
    final b = Global.currentBrightness(context) == Brightness.light;