heelp me I want to send text from the first page to the second page.
Firts Page
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: RaisedGradientButton(
child: Text(
'Dapatkan Pengukuran',
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
fontFamily: 'Nunito',
fontWeight: FontWeight.bold),
),
gradient: LinearGradient(
colors: const <Color>[Colors.purple, Colors.blue],
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ShowMeasurementsPage(
name: name.text,
nohap: nohap.text,
),
),
);
}),
)
Second Page*
and i want showing text this second page but error.
import 'package:flutter/material.dart';
class ShowMeasurementsPage extends StatefulWidget {
static String tag = 'show-measurements-page';
const ShowMeasurementsPage({Key? key}) : super(key: key);
@override
_ShowMeasurementsPageState createState() => _ShowMeasurementsPageState();
}
class _ShowMeasurementsPageState extends State<ShowMeasurementsPage> {
final String? name, nohap;
_ShowMeasurementsPageState({this.name, this.nohap});
can anyone help me?