Movator: Unterschied zwischen den Versionen

Aus Info-Theke
Zur Navigation springen Zur Suche springen
Zeile 10: Zeile 10:
flutter create --project-name=$PROJ --platforms=linux,android --template=app \
flutter create --project-name=$PROJ --platforms=linux,android --template=app \
   --description="Moves and renames files into different target directories" .
   --description="Moves and renames files into different target directories" .
mkdir models controllers pages
mkdir lib/models lib/controllers lib/screens
vi pubspec.yaml
vi pubspec.yaml
# dependencies:
# dependencies:
Zeile 16: Zeile 16:
flutter get pub
flutter get pub
</syntaxhighlight>
</syntaxhighlight>
= Startseite festlegen =
* change lib/main.dart:
<syntaxhighlight lang=dart>
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'screens/sortator_screen.dart';
void main() {
  runApp(GetMaterialApp(
    home: SortatorScreen(),));
}
</syntaxhighlight>
= Modul erstellen =
* create a file models\sortator.dart
* create a file models\sortator.dart
<syntaxhighlight lang=dart>
<syntaxhighlight lang=dart>
Zeile 23: Zeile 37:
}
}
</syntaxhighlight>
</syntaxhighlight>
* create a file controller\ortator_controler.dart
* create a file lib/controller/sortator_controller.dart
<syntaxhighlight lang=dart>
<syntaxhighlight lang=dart>
import 'package:get/get.dart';
import '../controllers/sortator.dart';
class SortatorController extends GetxController {
class SortatorController extends GetxController {
  final sortator = Sortator().obs;
}
</syntaxhighlight>
* create a file lib/screens/sortator_screen.dart
</syntaxhighlight>
* create a file controller/sortator_controller.dart
<syntaxhighlight lang=dart>
import 'package:flutter/material.dart';
class SortatorScreen extends GetxController {
   final sortator = Sortator().obs;
   final sortator = Sortator().obs;
}
}
</syntaxhighlight>
</syntaxhighlight>

Version vom 21. August 2022, 12:25 Uhr

Links

Erzeugen

PROJ=sortator
cd /home/ws/flutter
mkdir $PROJ
cd $PROJ
flutter create --project-name=$PROJ --platforms=linux,android --template=app \
  --description="Moves and renames files into different target directories" .
mkdir lib/models lib/controllers lib/screens
vi pubspec.yaml
# dependencies:
#   g: ^4.6.5
flutter get pub

Startseite festlegen

  • change lib/main.dart:
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'screens/sortator_screen.dart';
void main() {
  runApp(GetMaterialApp(
    home: SortatorScreen(),));
}

Modul erstellen

  • create a file models\sortator.dart
class Sortator {
  final List<String> targetDirectories = [];
  final List<String> categories = [];
}
  • create a file lib/controller/sortator_controller.dart
import 'package:get/get.dart';
import '../controllers/sortator.dart';
class SortatorController extends GetxController {
  final sortator = Sortator().obs;
}
  • create a file lib/screens/sortator_screen.dart

</syntaxhighlight>

  • create a file controller/sortator_controller.dart
import 'package:flutter/material.dart';

class SortatorScreen extends GetxController {
  final sortator = Sortator().obs;
}