Skip to content

Commit

Permalink
Upgrade to flutter 3
Browse files Browse the repository at this point in the history
  • Loading branch information
lunacd committed Feb 22, 2024
1 parent 45fe6c1 commit 4129f3b
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 127 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ jobs:
# Steps adapted from the official flutter orb
- restore_cache:
keys:
- flutter-2.10.5-{{ arch }}
- flutter-3.19.1-{{ arch }}
- run:
name: Install Flutter SDK if not exists
command: |
if [ ! -d ~/development/flutter ]; then
mkdir -p ~/development
curl -o flutter_sdk.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_2.10.5-stable.zip
curl -o flutter_sdk.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.19.1-stable.zip
unzip -qq flutter_sdk.zip -d ~/development
rm flutter_sdk.zip
fi
echo 'export PATH=~/development/flutter/bin:$PATH' >> $BASH_ENV
- run: flutter doctor
- save_cache:
key: flutter-2.10.5-{{ arch }}
key: flutter-3.19.1-{{ arch }}
paths:
- ~/development
- restore_cache:
Expand Down Expand Up @@ -55,13 +55,13 @@ jobs:
- checkout
- restore_cache:
keys:
- flutter-2.10.5-{{ arch }}
- flutter-3.19.1-{{ arch }}
- run:
name: Install Flutter SDK if not exists
command: |
if [ ! -d ~/development/flutter ]; then
mkdir -p ~/development
curl -o flutter_sdk.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_2.10.5-stable.zip
curl -o flutter_sdk.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_3.19.1-stable.zip
unzip -qq flutter_sdk.zip -d ~/development
rm flutter_sdk.zip
fi
Expand All @@ -71,7 +71,7 @@ jobs:
command: flutter doctor
shell: bash.exe
- save_cache:
key: flutter-2.10.5-{{ arch }}
key: flutter-3.19.1-{{ arch }}
paths:
- ~\development
- restore_cache:
Expand All @@ -95,7 +95,7 @@ jobs:
shell: bash.exe
- run:
name: Compress Artifacts
command: tar -C build\windows\runner\Release -cvzf windows.tar.gz .
command: tar -C build\windows\x64\runner\Release -cvzf windows.tar.gz .
- store_artifacts:
path: windows.tar.gz

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.4'
flutter-version: '3.19.1'
channel: 'stable'

- name: Get dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.4'
flutter-version: '3.19.1'
channel: 'stable'

- name: Get dependencies
Expand Down
2 changes: 1 addition & 1 deletion lib/scheduling.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class Scheduling {
}
line[17 + i * 3] = courseData.reading;
}
output.writeAsStringSync(line.join('\t') + '\n', mode: FileMode.append);
output.writeAsStringSync('${line.join('\t')}\n', mode: FileMode.append);
}
}

Expand Down
10 changes: 6 additions & 4 deletions lib/widgets/class_name_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class ClassNameDisplayState extends State<ClassNameDisplay> {
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (widget.currentRow != RowType.none)
Text(
Expand All @@ -180,7 +181,6 @@ class ClassNameDisplayState extends State<ClassNameDisplay> {
const TextStyle(fontSize: 40, fontWeight: FontWeight.bold),
)
],
mainAxisAlignment: MainAxisAlignment.start,
),
Wrap(
direction: Axis.horizontal,
Expand All @@ -190,15 +190,17 @@ class ClassNameDisplayState extends State<ClassNameDisplay> {
style: (() {
if (_selected[i] == true) {
return ElevatedButton.styleFrom(
primary: Colors.red, onPrimary: Colors.white);
foregroundColor: Colors.white,
backgroundColor: Colors.red);
} else {
int clusterIndex = widget.schedule.splitControl
.getClusterIndex(widget.people[i]);
if (clusterIndex == -1) {
return ElevatedButton.styleFrom(primary: Colors.white);
return ElevatedButton.styleFrom(
backgroundColor: Colors.white);
} else {
return ElevatedButton.styleFrom(
primary: clusterColors[
backgroundColor: clusterColors[
clusterIndex % clusterColors.length]);
}
}
Expand Down
10 changes: 5 additions & 5 deletions lib/widgets/class_size_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:omnilore_scheduler/scheduling.dart';
import 'package:omnilore_scheduler/theme.dart';
import 'package:omnilore_scheduler/widgets/utils.dart';

const modeDescriptions = <String>['spliting', 'limiting'];
const modeDescriptions = <String>['splitting', 'limiting'];

class ClassSizeControl extends StatefulWidget {
const ClassSizeControl(
Expand Down Expand Up @@ -90,8 +90,8 @@ class ClassSizeControlState extends State<ClassSizeControl> {
color: Colors.black))),
],
),
Row(
children: const [
const Row(
children: [
SizedBox(height: 10),
],
),
Expand Down Expand Up @@ -134,8 +134,8 @@ class ClassSizeControlState extends State<ClassSizeControl> {
hint: Text(course),
items: (<String>['ALL'].followedBy(widget.courses)).map((String value) {
return DropdownMenuItem(
child: Text(value),
value: value,
child: Text(value),
);
}).toList(),
onChanged: (String? newValue) {
Expand Down Expand Up @@ -198,7 +198,7 @@ class ClassSizeControlState extends State<ClassSizeControl> {
} else {
String error;
if (minValue == '' || maxValue == '') {
error = 'Please enter a value for bothmin and max';
error = 'Please enter a value for both min and max';
} else {
error = 'Please import courses first';
}
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/overview_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ class OverviewData extends StatelessWidget {
color: themeColors['LightBlue'],
constraints: const BoxConstraints.expand(),
child: DefaultTextStyle(
style: const TextStyle(fontSize: 20, color: Colors.black),
child: Column(
children: [
Text('\nCourse Takers $courseTakers'),
Text('Course Takers $courseTakers'),
Text('Go Courses $goCourses'),
Text('Places Asked $placesAsked'),
Text('Places Given $placesGiven'),
Expand All @@ -43,7 +44,6 @@ class OverviewData extends StatelessWidget {
const Text('Missing 0'),
],
),
style: const TextStyle(fontSize: 20, color: Colors.black),
),
);
}
Expand Down
38 changes: 25 additions & 13 deletions lib/widgets/screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Screen extends StatefulWidget {
const Screen({Key? key}) : super(key: key);

@override
_ScreenState createState() => _ScreenState();
State<Screen> createState() => _ScreenState();
}

class _ScreenState extends State<Screen> {
Expand Down Expand Up @@ -173,8 +173,10 @@ class _ScreenState extends State<Screen> {
List<bool>.filled(numCourses!, false, growable: true);
compute(Change.course);
} catch (e) {
Utils.showPopUp(
context, 'Error loading courses', e.toString());
if (context.mounted) {
Utils.showPopUp(
context, 'Error loading courses', e.toString());
}
}
}
}
Expand All @@ -194,8 +196,10 @@ class _ScreenState extends State<Screen> {
try {
numPeople = await schedule.loadPeople(path);
} catch (e) {
Utils.showPopUp(
context, 'Error loading people', e.toString());
if (context.mounted) {
Utils.showPopUp(
context, 'Error loading people', e.toString());
}
}
}
} else {
Expand All @@ -215,8 +219,10 @@ class _ScreenState extends State<Screen> {
try {
schedule.exportState(path);
} catch (e) {
Utils.showPopUp(
context, 'Error saving state', e.toString());
if (context.mounted) {
Utils.showPopUp(
context, 'Error saving state', e.toString());
}
}
}
}
Expand Down Expand Up @@ -266,8 +272,10 @@ class _ScreenState extends State<Screen> {
try {
schedule.outputRosterPhone(path);
} catch (e) {
Utils.showPopUp(context, 'Error exporting early roster',
e.toString());
if (context.mounted) {
Utils.showPopUp(context,
'Error exporting early roster', e.toString());
}
}
}
} else {
Expand All @@ -286,8 +294,10 @@ class _ScreenState extends State<Screen> {
}
schedule.outputRosterCC(path);
} catch (e) {
Utils.showPopUp(context,
'Error exporting roster with CC', e.toString());
if (context.mounted) {
Utils.showPopUp(context,
'Error exporting roster with CC', e.toString());
}
}
}
} else {
Expand All @@ -304,8 +314,10 @@ class _ScreenState extends State<Screen> {
try {
schedule.outputMM(path);
} catch (e) {
Utils.showPopUp(
context, 'Error exporting MailMerge', e.toString());
if (context.mounted) {
Utils.showPopUp(
context, 'Error exporting MailMerge', e.toString());
}
}
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/table/drop_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
class DropRow extends TableRow {
DropRow(List<bool> droppedList, void Function(int) onDroppedChanged)
: super(children: [
TableCell(
const TableCell(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[Text('class dropped')])),
children: <Widget>[Text('class dropped')])),
for (int i = 0; i < droppedList.length; i++)
Checkbox(
checkColor: Colors.white,
Expand Down
6 changes: 3 additions & 3 deletions lib/widgets/table/schedule_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class ScheduleRow extends TableRow {
children: <Widget>[Text(scheduleRows[timeIndex])])),
for (int i = 0; i < data.length; i++)
TextButton(
child: Text(data[i].toString()),
onPressed: droppedList[i] == false &&
(state == StateOfProcessing.schedule ||
state == StateOfProcessing.coordinator ||
Expand All @@ -51,11 +50,12 @@ class ScheduleRow extends TableRow {
: null,
style: (() {
if (scheduleData[i] == timeIndex) {
return ElevatedButton.styleFrom(primary: Colors.red);
return ElevatedButton.styleFrom(backgroundColor: Colors.red);
} else {
return ElevatedButton.styleFrom(primary: Colors.transparent);
return ElevatedButton.styleFrom(backgroundColor: Colors.transparent);
}
}()),
child: Text(data[i].toString()),
)
]);
}
8 changes: 8 additions & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
desktop_window
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
Expand All @@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
Loading

0 comments on commit 4129f3b

Please sign in to comment.