@@ -14,7 +14,7 @@ class MyApp extends StatefulWidget {
1414
1515class _MyAppState extends State <MyApp > {
1616 PDFDoc ? _pdfDoc;
17- String ? _text = "" ;
17+ String _text = "" ;
1818
1919 bool _buttonsEnabled = true ;
2020
@@ -35,32 +35,35 @@ class _MyAppState extends State<MyApp> {
3535 padding: EdgeInsets .all (10 ),
3636 child: ListView (
3737 children: < Widget > [
38- FlatButton (
38+ TextButton (
3939 child: Text (
4040 "Pick PDF document" ,
4141 style: TextStyle (color: Colors .white),
4242 ),
43- color: Colors .blueAccent,
43+ style: TextButton .styleFrom (
44+ padding: EdgeInsets .all (5 ),
45+ backgroundColor: Colors .blueAccent),
4446 onPressed: _pickPDFText,
45- padding: EdgeInsets .all (5 ),
4647 ),
47- FlatButton (
48+ TextButton (
4849 child: Text (
4950 "Read random page" ,
5051 style: TextStyle (color: Colors .white),
5152 ),
52- color: Colors .blueAccent,
53+ style: TextButton .styleFrom (
54+ padding: EdgeInsets .all (5 ),
55+ backgroundColor: Colors .blueAccent),
5356 onPressed: _buttonsEnabled ? _readRandomPage : () {},
54- padding: EdgeInsets .all (5 ),
5557 ),
56- FlatButton (
58+ TextButton (
5759 child: Text (
5860 "Read whole document" ,
5961 style: TextStyle (color: Colors .white),
6062 ),
61- color: Colors .blueAccent,
63+ style: TextButton .styleFrom (
64+ padding: EdgeInsets .all (5 ),
65+ backgroundColor: Colors .blueAccent),
6266 onPressed: _buttonsEnabled ? _readWholeDoc : () {},
63- padding: EdgeInsets .all (5 ),
6467 ),
6568 Padding (
6669 child: Text (
@@ -80,7 +83,7 @@ class _MyAppState extends State<MyApp> {
8083 ),
8184 padding: EdgeInsets .all (15 ),
8285 ),
83- Text (_text! ),
86+ Text (_text),
8487 ],
8588 ),
8689 )),
@@ -105,7 +108,7 @@ class _MyAppState extends State<MyApp> {
105108 _buttonsEnabled = false ;
106109 });
107110
108- String ? text =
111+ String text =
109112 await _pdfDoc! .pageAt (Random ().nextInt (_pdfDoc! .length) + 1 ).text;
110113
111114 setState (() {
0 commit comments