Browse Source

First structure steps

main
Artemis 3 months ago
parent
commit
c74f3dfd93
  1. 17
      .packages
  2. 24
      README.md
  3. 4
      lib/constants.dart
  4. 30
      lib/fragments/BaseScaffold.dart
  5. 110
      lib/main.dart
  6. 14
      lib/pages/WordCounter.dart
  7. 30
      test/widget_test.dart

17
.packages

@ -3,27 +3,12 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2021-09-05 20:12:55.576146.
async:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.6.1/lib/
boolean_selector:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib/
# Generated by pub on 2021-09-05 20:20:34.590547.
characters:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0/lib/
charcode:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/
clock:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib/
collection:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib/
cupertino_icons:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-1.0.3/lib/
fake_async:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0/lib/
flutter:file:///home/diane/dev/softwares/flutter/packages/flutter/lib/
flutter_test:file:///home/diane/dev/softwares/flutter/packages/flutter_test/lib/
matcher:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10/lib/
meta:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/
path:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0/lib/
sky_engine:file:///home/diane/dev/softwares/flutter/bin/cache/pkg/sky_engine/lib/
source_span:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib/
stack_trace:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib/
stream_channel:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0/lib/
string_scanner:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0/lib/
term_glyph:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0/lib/
test_api:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.3.0/lib/
typed_data:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib/
vector_math:file:///home/diane/dev/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0/lib/
apollo:lib/

24
README.md

@ -3,3 +3,27 @@
![trans rights!](https://awoo.systems/trans_rights_badge.svg)
A writer's assistant.
## Goals and features
This app has a single aim: to simplify my workflow when writing stuff, mostly when on my phone or
tablet (travel hardware restrictions).
I am trying to make it as lightweight as possible (even though I am using Flutter and not direct
native android, but native android sucks right now... And Compose seems even weirder) and as
accessible as I can, but feel free to start threads on things you'd like to see change.
For now, I plan for the following.
- Word counter
- Spell checking (somehow?)
- Linguee / Deepl / something else? API integration for dictionary and translation
- Something API integration for synonyms
## Releases and such
I have no real release system planned yet.
I do intend to publish it on my personal website's projects section at first, then possibly on
F-Droid.
I *do not* (and this won't change) intend to publish it on Google Play Store.

4
lib/constants.dart

@ -0,0 +1,4 @@
import 'package:flutter/material.dart';
const title = 'Apollo';
const themeColor = Colors.pink;

30
lib/fragments/BaseScaffold.dart

@ -0,0 +1,30 @@
import 'package:apollo/constants.dart';
import 'package:flutter/material.dart';
Widget route(NavigatorState nav, String to, IconData icon, String label) =>
ListTile(
title: Text(label),
leading: Icon(icon),
onTap: () => nav.pushNamedAndRemoveUntil(to, (route) => route.isFirst),
);
Widget scaffold(BuildContext ctx, {body: Widget}) => Scaffold(
body: body,
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
const DrawerHeader(
decoration: BoxDecoration(color: themeColor),
child: const Text(title),
),
route(
Navigator.of(ctx),
'word-counter',
Icons.calculate,
'Word counter',
),
],
),
),
);

110
lib/main.dart

@ -1,113 +1,23 @@
import 'package:apollo/constants.dart';
import 'package:apollo/pages/WordCounter.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
runApp(ApolloEntrypoint());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
class ApolloEntrypoint extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
title: title,
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
primarySwatch: themeColor,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
initialRoute: 'word-counter',
routes: {
'word-counter': (_) => WordCounter(),
},
);
}
}

14
lib/pages/WordCounter.dart

@ -0,0 +1,14 @@
import 'package:apollo/fragments/BaseScaffold.dart';
import 'package:flutter/material.dart';
class WordCounter extends StatelessWidget {
@override
Widget build(BuildContext context) => scaffold(
context,
body: Column(
children: [
Text('Meow'),
],
),
);
}

30
test/widget_test.dart

@ -1,30 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:apollo/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
Loading…
Cancel
Save