Movie Search
This commit is contained in:
@@ -45,42 +45,93 @@ class TVShowFilterBox extends StatelessWidget {
|
||||
callSetFilter();
|
||||
}
|
||||
|
||||
Widget buildScreen(BuildContext context) {
|
||||
double width = MediaQuery.sizeOf(context).width;
|
||||
|
||||
if (width < 500.0) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: TextField(
|
||||
style: TextStyle(color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'TVShow Title',
|
||||
),
|
||||
onChanged: (text) {
|
||||
textCallback(text);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Init',
|
||||
callback: initCallback,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Progress',
|
||||
callback: progCallback,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Done',
|
||||
callback: doneCallback,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: TextField(
|
||||
style: TextStyle(color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'TVShow Title',
|
||||
),
|
||||
onChanged: (text) {
|
||||
textCallback(text);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Init',
|
||||
callback: initCallback,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Progress',
|
||||
callback: progCallback,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Done',
|
||||
callback: doneCallback,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: TextField(
|
||||
style: TextStyle(color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'TVShow Title',
|
||||
),
|
||||
onChanged: (text) {
|
||||
textCallback(text);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Init',
|
||||
callback: initCallback,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Progress',
|
||||
callback: progCallback,
|
||||
),
|
||||
CheckboxWithLabel(
|
||||
label: 'Done',
|
||||
callback: doneCallback,
|
||||
),
|
||||
],
|
||||
);
|
||||
return buildScreen(context);
|
||||
}
|
||||
|
||||
void callSetFilter() {
|
||||
|
||||
@@ -363,7 +363,6 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
appBar: AppBar(
|
||||
title: Text('TV Shows'),
|
||||
actions: [
|
||||
TVShowFilterBox(setFilter: setFilter),
|
||||
const VerticalDivider(
|
||||
width: 10,
|
||||
thickness: 3,
|
||||
@@ -399,48 +398,57 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
),
|
||||
],
|
||||
),
|
||||
body: FutureBuilder<Object>(
|
||||
future: generateTVShowList(),
|
||||
builder: (context, data) {
|
||||
return data.hasData
|
||||
? SfDataGridTheme(
|
||||
data: const SfDataGridThemeData(
|
||||
headerColor: Color(0xff009889),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
source: tvshowDataSource,
|
||||
selectionMode: SelectionMode.single,
|
||||
navigationMode: GridNavigationMode.row,
|
||||
columns: _columns,
|
||||
controller: _dataGridController,
|
||||
columnWidthMode: ColumnWidthMode.auto,
|
||||
columnWidthCalculationRange:
|
||||
ColumnWidthCalculationRange.allRows,
|
||||
onCellTap: (DataGridCellTapDetails details) {
|
||||
int index = details.rowColumnIndex.rowIndex - 1;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
showTVShowDetails(index);
|
||||
},
|
||||
onCellDoubleTap: (DataGridCellDoubleTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellLongPress: (DataGridCellLongPressDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellSecondaryTap: (DataGridCellTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
value: 0.8,
|
||||
),
|
||||
);
|
||||
},
|
||||
body: Column(
|
||||
children: [
|
||||
TVShowFilterBox(setFilter: setFilter),
|
||||
Expanded(
|
||||
child: FutureBuilder<Object>(
|
||||
future: generateTVShowList(),
|
||||
builder: (context, data) {
|
||||
return data.hasData
|
||||
? SfDataGridTheme(
|
||||
data: const SfDataGridThemeData(
|
||||
headerColor: Color(0xff009889),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
source: tvshowDataSource,
|
||||
selectionMode: SelectionMode.single,
|
||||
navigationMode: GridNavigationMode.row,
|
||||
columns: _columns,
|
||||
controller: _dataGridController,
|
||||
columnWidthMode: ColumnWidthMode.auto,
|
||||
columnWidthCalculationRange:
|
||||
ColumnWidthCalculationRange.allRows,
|
||||
onCellTap: (DataGridCellTapDetails details) {
|
||||
int index = details.rowColumnIndex.rowIndex - 1;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
showTVShowDetails(index);
|
||||
},
|
||||
onCellDoubleTap:
|
||||
(DataGridCellDoubleTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellLongPress:
|
||||
(DataGridCellLongPressDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellSecondaryTap: (DataGridCellTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
value: 0.8,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user