Skip to content

Commit

Permalink
refs IoTone#26 revert changes to the main ... not sure what was going…
Browse files Browse the repository at this point in the history
… in but it was broken
  • Loading branch information
truedat101 authored and pedroalvesbatista committed May 7, 2024
1 parent 6ed05d3 commit aa88e14
Showing 1 changed file with 1 addition and 102 deletions.
103 changes: 1 addition & 102 deletions magnet_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import 'package:provider/provider.dart';

import 'package:cbl_flutter/cbl_flutter.dart';

import 'package:horizontal_data_table/horizontal_data_table.dart';

import 'package:magnet_app/splash_page.dart';
import 'package:magnet_app/about.dart';
import 'package:magnet_app/app_state_model.dart';
Expand Down Expand Up @@ -36,7 +34,7 @@ Future<void> main() async {
});
}

class MyApp extends StatelessWidget, State<SimpleTablePage> {
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Expand Down Expand Up @@ -176,109 +174,12 @@ class MyHomePage extends StatelessWidget {
style: TextStyle(color: _textColor(context)),
)),
*/
HorizontalDataTable(
leftHandSideColumnWidth: 100,
rightHandSideColumnWidth: 600,
isFixedHeader: true,
headerWidgets: _getTitleWidget(),
isFixedFooter: true,
footerWidgets: _getTitleWidget(),
leftSideItemBuilder: _generateFirstColumnRow,
rightSideItemBuilder: _generateRightHandSideColumnRow,
itemCount: widget.user.userInfo.length,
rowSeparatorWidget: const Divider(
color: Colors.black38,
height: 1.0,
thickness: 0.0,
),
leftHandSideColBackgroundColor: const Color(0xFFFFFFFF),
rightHandSideColBackgroundColor: const Color(0xFFFFFFFF),
itemExtent: 55,
),
],
),
),
);


}

List<Widget> _getTitleWidget() {
return [
_getTitleItemWidget('Name', 100),
_getTitleItemWidget('Status', 100),
_getTitleItemWidget('Phone', 200),
_getTitleItemWidget('Register', 100),
_getTitleItemWidget('Termination', 200),
];
}

Widget _getTitleItemWidget(String label, double width) {
return Container(
width: width,
height: 56,
padding: const EdgeInsets.fromLTRB(5, 0, 0, 0),
alignment: Alignment.centerLeft,
child: Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
);
}

Widget _generateFirstColumnRow(BuildContext context, int index) {
return Container(
width: 100,
height: 52,
padding: const EdgeInsets.fromLTRB(5, 0, 0, 0),
alignment: Alignment.centerLeft,
child: Text(widget.user.userInfo[index].name),
);
}

Widget _generateRightHandSideColumnRow(BuildContext context, int index) {
return Row(
children: <Widget>[
Container(
width: 100,
height: 52,
padding: const EdgeInsets.fromLTRB(5, 0, 0, 0),
alignment: Alignment.centerLeft,
child: Row(
children: <Widget>[
Icon(
widget.user.userInfo[index].status
? Icons.notifications_off
: Icons.notifications_active,
color: widget.user.userInfo[index].status
? Colors.red
: Colors.green),
Text(widget.user.userInfo[index].status ? 'Disabled' : 'Active')
],
),
),
Container(
width: 200,
height: 52,
padding: const EdgeInsets.fromLTRB(5, 0, 0, 0),
alignment: Alignment.centerLeft,
child: Text(widget.user.userInfo[index].phone),
),
Container(
width: 100,
height: 52,
padding: const EdgeInsets.fromLTRB(5, 0, 0, 0),
alignment: Alignment.centerLeft,
child: Text(widget.user.userInfo[index].registerDate),
),
Container(
width: 200,
height: 52,
padding: const EdgeInsets.fromLTRB(5, 0, 0, 0),
alignment: Alignment.centerLeft,
child: Text(widget.user.userInfo[index].terminationDate),
),
],
);
}

Color? _iconsColor(BuildContext context) {
final theme = NeumorphicTheme.of(context);
if (theme!.isUsingDark) {
Expand Down Expand Up @@ -328,6 +229,4 @@ Widget switchScreen(AppState app_provider) {
default:
throw Exception("$app_provider.app_screen is not a valid screen state");
}


}

0 comments on commit aa88e14

Please sign in to comment.