~cytrogen/fluent-reader-mobile

ref: d61062f4139b621c3e58f6c69f815e46ba83ec65 fluent-reader-mobile/lib/pages/setup_page.dart -rw-r--r-- 2.6 KiB
d61062f4 — Bruce Liu add unread sources only option 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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: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) {
    Navigator.of(context).pushNamed(route);
  }

  @override
  Widget build(BuildContext context) {
    final welcomeStyle = TextStyle(
      color: CupertinoColors.label.resolveFrom(context),
      fontSize: 24,
      fontWeight: FontWeight.bold,
      height: 1.5,
    );
    final top = Container(
      padding: EdgeInsets.symmetric(vertical: 100),
      child: Column(
        children: [
          Image.asset("assets/icons/logo.png", width: 80, height: 80),
          Text(S.of(context).welcome, style: welcomeStyle),
        ],
      ),
    );
    final services = ListTileGroup([
      MyListTile(
        title: Text("Fever API"),
        onTap: () { _configure(context, "/settings/service/fever"); },
      ),
      MyListTile(
        title: Text("Google Reader API"),
        onTap: () { _configure(context, "/settings/service/greader"); },
      ),
      MyListTile(
        title: Text("Inoreader"),
        onTap: () { _configure(context, "/settings/service/inoreader"); },
      ),
      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;
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: b ? SystemUiOverlayStyle.dark : SystemUiOverlayStyle.light,
      child: page,
    );
  }
}